Game Development Community

About Unicode and UTF8

by Nabarro · in Torque 3D Professional · 06/22/2010 (2:40 am) · 3 replies

How to convert Unicode characters to UTF8 format in engine? I need to copy some texts which is encoded with Unicode format into engine text edit control. How to do the conversion? Is there any code for reference?

Thank you very much.

#1
06/22/2010 (5:32 am)
By "copy and paste", you mean using the clipboard to paste directly into the GUI? If so, that won't work, because T3D reads the ANSI clipboard, which is "filtered".

If all you want is display UTF8 text, you can do it by either reading the text from a UTF8 .txt file using FileObject or saving your .cs scripts in UTF8 and typing the text directly into them.

If you want to input/paste UTF8 text directly into the engine, you'll need this: www.torquepowered.com/community/forums/viewthread/116785
#2
06/22/2010 (7:31 pm)
Thank you, Manoel.

Yes, we want to do "copy and paste" from clipboard into the GUI control.

Since T3D reads the ANSI clipboard, how can we make it read Unicode clipboard? For example, when we copy some characters from web page, the windows clipboard should save some characters encoded wiht Unicode format. Then, we do Ctrl+c to paste the characters into our chat dialog control.

The problem is that our chat dialog control read UTF8 format chars, and the Unicode clipboard saves Unicode chars, how to do the conversion from Unicode to UTF8?
Could you please provide any suggestions? Thanks a lot.
#3
06/22/2010 (9:44 pm)
Ok, it's solved by referencing to Manoel's link. Thanks.