converting non-unicode, non-english content to unicode

删除回忆录丶 提交于 2019-12-10 17:47:53

问题


I've a text content in "xyz" language.

<p style="font-family:xyz;"> eWvS³: kmwkMnsâ kq¸Àt^mWmb KmeIvkn kocoknsâ aq¶mw]Xn¸v </p>
// It will not display correctly as font is not embedded.

here the font xyz (xyz.ttf) is non unicode.

Now I want to convert that "XYZ" (xyz.ttf) font text to unicode "PQR" (pqr.ttf) font

Simply, a non-unicode Chinese (non_uni_chinese.ttf) to uniocode Chinese (uni_chinese.ttf)

how can I make it possible using php. any help?


回答1:


You must do this "character by character".

It's mean you must replace every character in "non-Unicode Chinese" font to Unicode font. I don't know much about Chinese, but in Vietnam, they use this way:

  1. Write a string that contains "non-Unicode" font by an Unicode font, and these characters will not display correctly. For example: Ñaây laø Tieáng Vieät <- this is a non-Unicode Vietnamese write with an Unicode font.
  2. Replace "character by character". For example: Ñ = Đ; aâ = â; aø = 2;...
  3. Then we have this result: Đây là Tiếng Việt.

Of course we don't do it step-by-step, we use a software called "Unikey" to do this.

And I'm sure that there is a software to do that in Chinese. The point here is you must "do" it again in PHP.

Here come something can help you: http://www.pinyin.info/tools/converter/chars2uninumbers.html

Good luck.




回答2:


Generated output should use one encoding. It's not proper solution, but anyway, for converting string to different encoding you should use iconv function http://www.php.net/manual/en/function.iconv.php



来源:https://stackoverflow.com/questions/10773863/converting-non-unicode-non-english-content-to-unicode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!