xuhao394 wrote:
Hi,
I'm using PrizmSDK and libfxcg found on github (https://github.com/Jonimoose/libfxcg), and found out that Chinese characters are shown as blank with the standard Print functions.
According to WikiPrizm, there might be flags or special system functions that enables Chinese output, but unfortunately it isn't descripted in detail.
So, has anyone figured out what should be done to print Chinese characters now? If not, is there any debuggers for fx-CG Manager Plus available so I can try to look into official Chinese applets (like Physium.g3a) and see what they do to display Chinese?
Deeply thanks.<3
I've done some research and found how Chinese characters can be printed.
Normally, when one wants to print some English text, it can be done as follows: Code: PrintXY(1, 1, " Hello!", 0, 0);
Output:
Hello!
A similar process can be followed for printing Chinese text: Code: PrintXY(1, 1, "\x3\xa8\xc4\xe3\xba\xc3!", 0, 0);
Output:
你好!
More generally, to start printing Chinese, one should begin the string with "\x3\xa8" instead of two spaces, and then add characters as follows:
1. Go to this GB18030 map and find your desired character (just use control + f).
2. Check the hex number in grey at the very left of that character's row. This is the first part of the character. For example, if this is C2, you should add "\xc2" to the end of your string.
3. Check the hex number in grey at the very top of that character's column. This is the second part of the character. For example, if this is 74, you should add "\x74" to the end of your string.
4. That's it! Add more characters using this process, or add english letters and punctuation as you would normally.
Here's an example:
You want to print "你叫什么名字?".
Follow the above process and you should end up with
你: \xc4\xe3
叫: \xbd\xd0
什: \xca\xb2
么: \xc3\xb4
名: \xc3\xfb
字: \xd7\xd6
? : ?
Thus, your string should be "\x3\xa8\xc4\xe3\xbd\xd0\xca\xb2\xc3\xb4\xc3\xfb\xd7\xd6?"
Put this into PrintXY and it should print
"你叫什么名字?"
Alternatively, if you have python on your device, you can use this to convert the Chinese to gb18030 using the string encode() method.
Here is an example: Code: "你叫什么名字?".encode("gb18030")
Output:
b'\xc4\xe3\xbd\xd0\xca\xb2\xc3\xb4\xc3\xfb\xd7\xd6?'
From this, copy the text from inside the quotes and add "\x3\xa8" to the start, as done previously. Put this into PrintXY and it will also print "你叫什么名字?".
Let me know if any of this doesn't make sense or needs further explanation.