简体   繁体   English

get_meta_tags和波斯语短语

[英]get_meta_tags and persian phrases

I used this function, 我用过这个功能,

 $code = get_meta_tags('http://www.narenji.ir/');

and I've seen this 我见过这个

  'مکانی برای آشنایی با ابزارها Ùˆ اخبار داغ دنیای Ùناوری'

How can I fix this issue? 我该如何解决这个问题? Can I fix it without using JSON? 我可以在不使用JSON的情况下修复它吗?

You must be missing some link here, your code just works: 你必须在这里遗漏一些链接,你的代码才有效:

The key point is that you preserve the UTF-8 encoding so that Persian is supported. 关键是您保留 UTF-8编码,以便支持波斯语。 Otherwise you would need some other encoding (one that I do not yet know) that supports Persian and a library that is able to re-encode that. 否则你需要一些支持波斯语的其他编码(一个我还不知道的编码)和一个能够重新编码的编码。

Which encoding do you want to use for Persian output? 您想将哪种编码用于波斯输出?

If you are executing your script from a browser, make sure you sending UTF-8 as your content encoding. 如果从浏览器执行脚本,请确保将UTF-8作为内容编码发送。 Add a Content-Type header before echo'ing anything. 回显任何东西之前添加Content-Type标头。

header('Content-Type:text/html; charset=utf-8');

utf8_decode() is built specifically for converting from UTF-8 to ISO-8859-1 (latin1). utf8_decode()专为从UTF-8转换为ISO-8859-1(latin1)而构建。 Persian characters are not in Latin1, so why would you feel it's necessary here?? 波斯语字符不是拉丁语1,所以为什么你觉得这里有必要?

working example: http://codepad.viper-7.com/tEjZAz 工作实例: http//codepad.viper-7.com/tEjZAz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM