Reputation: 540
I'm trying to submit '€' (typed on input type=text) but I'm receiving "â?¬" instead.
Do we have any solution for this to make me receive correct '€' symbol?
Upvotes: 1
Views: 3020
Reputation: 42890
You are receiving a € as it is encoded in UTF-8, but you interpret it as a different encoding (possibly Windows-1252 or ISO-8859-1).
Judging by the characters you see (â?¬
), the byte sequence 0xE2 0x82 0xAC
match ISO-8859-1.
Look at the content-type header of the POST request, as this answer outline. It will indicate what encoding was used when submitting the form.
Edit:
If you get a single ?
when you switch to interpreting the form data as UTF-8, you probably have interpreted it correctly. The reason you do not see a nice €
could be because you look at the data with an ISO-8859-1 terminal instead of an ISO-8859-15 terminal (the former does not have an € sign defined).
Now is a good time to read Joels The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Upvotes: 0
Reputation: 3597
You could try using the HTML name i.e. €
See this link for a full list of ASCII codes and HTML equivalents
Upvotes: 0
Reputation: 6726
TRY : insert €
inside textbox and submit, it will echo
symbol
<form action="" method="post">
<input type="text" name="test" />
<input type="submit" value="go" name="submit"/>
</form>
PHP
<?php
if(isset($_POST['submit'])) {
echo $_POST['test'];
exit;
}
?>
Upvotes: 0