I expected this code:
define('EURO_SIMBOLO', chr(128));
$euro = EURO_SIMBOLO;
var_dump($euro);
to show the €
symbol, but it doesn't. Why does this happen?
I expected this code:
define('EURO_SIMBOLO', chr(128));
$euro = EURO_SIMBOLO;
var_dump($euro);
to show the €
symbol, but it doesn't. Why does this happen?
If you want to go with Unicode, UTF-8 more specifically, which I prefer because of its flexibility, you can output the Euro sign using:
echo "\xE2\x82\xAc"; // 3 bytes-long multibyte character
Instead of € (alt + 0128)
switch your euro code to
€
This will only work if you're using a 125x code page. The fact is that the euro character is not included in all extended ASCII character sets (introduced in ISO/IEC 8859-15), however it does have a de-facto Unicode character.
If this is simply for displaying in a browser, consider using either '€'
or '€'
If you are using such a character set with the euro-symbol you’re most likely using iso-8859-15 in which the '€' character is defined at position 164. So you might have more luck if you replace 128 by 164, although this won’t help you in utf-8 environments in which the previous answer might be more suited.
In the CP1252 encoding of € has the code 128; In ISO-8859-15 the code is 164; Macintosh Roman is 219;
The euro sign is a part of the ASCII. Look that http://www.ascii-code.com/
© 2022 - 2024 — McMap. All rights reserved.
\xA4
or164
then. – Joinery