Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top