问题描述
我想在PHP中输出以下字符串:
äöü߀
因此,我已经将其编码为utf8手动:
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ是:
<?php
header('content-type:text / html; charset = utf-8 );
echo'ÃÃÃÃÃÃÂÂ
?>
前4个字符是正确的(äöüß),但不幸的是,€符号不正确:
äöüß
你能告诉我我做错了什么吗?我的编辑器(Notepad ++)有编码(Ansi / UTF-8)和格式(Windows / Unix)的设置。我必须改变他们吗?
希望你能帮助我。感谢提前!
最后一个字符只是不在文件中(尝试查看源代码),这就是为什么你没有看到它。
我认为您可能会更好地将PHP文件保存为UTF-8(在Notepad ++中,该选项在格式 - > Encode in UTF中可用-8没有BOM),并将实际的字符插入您的PHP文件(即在记事本++中),而不是在任何地方插入Ã
。您可能会发现Windows Character Map可用于插入unicode字符。
I want to output the following string in PHP:
ä ö ü ß €
Therefore, I've encoded it to utf8 manually:
ä ö ü ß €
So my script is:
<?php
header('content-type: text/html; charset=utf-8');
echo 'ä ö ü ß €';
?>
The first 4 characters are correct (ä ö ü ß) but unfortunately the € sign isn't correct:
ä ö ü ß
Can you tell me what I've done wrong? My editor (Notepad++) has settings for Encoding (Ansi/UTF-8) and Format (Windows/Unix). Do I have to change them?
I hope you can help me. Thanks in advance!
That last character just isn't in the file (try viewing the source), which is why you don't see it.
I think you might be better off saving the PHP file as UTF-8 (in Notepad++ that options is available in Format -> Encode in UTF-8 without BOM), and inserting the actual characters in your PHP file (i.e. in Notepad++), rather than hacking around with inserting Ã
everywhere. You may find Windows Character Map useful for inserting unicode characters.
这篇关于PHP中的编码问题(UTF-8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!