修复土耳其语字符集问题 Html / PHP(iconv?)
我在显示土耳其语字符时遇到问题,它们在 html 中显示为带有菱形背景的小问号。
如何使用 iconv 来解决这个问题?因为我认为这是最好的选择,对吗?现在我的页面是 utf-8 编码的。
我需要支持像
ı 这样的角色 ñ 以及
能够将它们插入到我的数据库中。
谢谢
i'm having troubles displaying turkish characters, they are appearing as the little question mark with the diamond in the background in html.
How can I use iconv to fix this? Since I think thats the best option right? Right now my page is utf-8 encoded.
I need to support characters like
ı
ñ
ş
aswell as be able to insert them into my db.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先我尝试了utf8编码解码,失败了,
将文件格式从 ASCII 更改为 UTF-8,
再次尝试utf编码,
多次更改文件格式但失败。
然后我发现了“iconv”,尝试但失败了。
使用“setlocale”更改区域设置。尝试过土耳其语、英语等类型,均失败。
最后我写了这个函数,我对输出很满意:)
First I tried, utf8 encode-decode, failed,
changed file format from ASCII to UTF-8,
tried utf encode again,
changed file format several times and failed.
Then i found out "iconv", tried and failed.
Changed locale with "setlocale". Tried Turkish, English and other types, failed.
At last i wrote this function and I'm happy with the output :)
通过使用解决了它
Solved it by using
尽管一般情况下确实如此,但如果 $text 包含一些土耳其语字符(例如“Çınar”),除非您的环境设置为在土耳其语区域设置上工作,否则翻译将失败。
如果您可能需要在 php 中设置区域设置,如下所示;
Although that's true in general if $text contains some Turkish chars like "Çınar" translition will fail unless your environment is set to work on Turkish locale.
In case you may need to set locale within php like below;