Hi all
Looked in the forum for similar problem but the few arguments found not give me a reply unfortunately...
I want to develop a japanese editor using Qt, however I'm facing some problem around it. First of all it seem Qt Creator doesn't manage to save source code file in unicode format. This mean if I try to put into the code something like:
string = "ã‚ãŸã—"
and close and reopen the project instead of the japanese characters above I find something like:
string = "???"
Anyway this is not a big problem. I can use the unicode character number instead of the direct typing. I can assign the unicode number of the character I'm interested in to a wchar_t variable and manage using this. However this second solution come with other problems. My japanese editor will be an open source project. I want to create some "indipendent" c++ class for manage some special operation like, for example, the conversion from romaji to hiragana/katakana or the reverse. With the "indipendent" word I mean I want to develop these classes "Qt free" for allow other people to get it and use then in their project that could be not Qt based but using a different architecture. For accomplish this goal inside the class I want to use the wstring for manage unicode text. Here I found the first problem that is not directly connected to Qt but if somehone can give me a suggestion about I'll be very graceful.
How can I convert wchar_t into wstring? I have a vector of wchar_t characters code, how can I use these codes for "compose" a wstring text? I still didn't find a way to this conversion.
So this class, after executed the requested operation, whatever is, will return a wstring with the japanese text to show inside the edit control (mainly I prefer to use a QPlainTextEdit control but also QTextEdit could be good if the first miss some feature). For conversion of this wstring I think I can use the QString::fromUtf16() method, is it correct?.
Now the second problem. When I try to assign some japanese text to my textedit control it show always ??? characters instead of japanese text. I thought it could be a problem of the font used (which font I need to use for make my code portable between Windows, Linux and mac?) but if I try to write some japanese text directly into the edit control using the Windows IME I can correctly see the japanese text over it. Than the font is correct? I'm a bit confused regarding unicode problems...
Excuse me for the long post
Thank you
Bookmarks