尝试使用 chr(128) 获取欧元符号
我期望这段代码:
define('EURO_SIMBOLO', chr(128));
$euro = EURO_SIMBOLO;
var_dump($euro);
显示 €
符号,但事实并非如此。为什么会出现这种情况?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您想使用 Unicode,更具体地说是 UTF-8,我更喜欢它,因为它的灵活性,您可以使用以下方式输出欧元符号:
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:
€ (alt + 0128)
将欧元代码改为
Instead of € (alt + 0128)
switch your euro code to
仅当您使用125x 代码页时,此功能才有效。事实上,欧元字符并未包含在所有扩展 ASCII 字符集中(在 ISO/IEC 8859-15 中引入),但它确实具有事实上的 Unicode 字符。
如果这只是为了在浏览器中显示,请考虑使用
'€'
或'€'
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'€'
如果您使用带有欧元符号的字符集,您很可能使用 iso-8859-15,其中“€”字符定义在位置 164。
因此,如果您将 128 替换为 164,您可能会更幸运,尽管这在 utf-8 环境中没有帮助,而之前的答案可能更适合。
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.
€ 的 CP1252 编码中的代码为 128;
在 ISO-8859-15 中,代码为 164;
Macintosh Roman 是 219;
欧元符号是 ASCII 的一部分。看看 http://www.ascii-code.com/
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/