How two byte support can be done.
How two byte support can be done.
Did you see QChar ?
1 how can this conversion done:
a) wchar_t* to char*
b) wchar_t* to LPSTR
NO i didn't see earlier but now i see it. but i have to do the conversion of wchar_t* to char* and wchar_t* to LPSTR.
If you insist on a Qt based solution, have a look at QString::fromWCharArray() and QString::toLatin1() etc.
{merged two and a half thread}
Please, don't start more than one thread on the same topic.
Is it really a Qt-related question?
yeah, i have to convert w_char_t* to char* and wchar_t* to LPSTR.
please help me out.
LPSTR is the same as char* so no conversion is required. As for wchar_t* it is the same as PWSTR and I'm sure that a visit to msdn.microsoft.com will reveal a proper conversion.
Moving the thread to general programming forum...
This answer is not quite right. It depends on the platform and, on Windows, whether "UNICODE" is defined or not. A wchar_t* is 2 bytes, ucs2, on a Windows machine. On a Mac or Unix machine, it is typically 4 bytes, usc4. I wouldn't bother doing this with C++ without QT. A QChar is UCS2 on all platforms. The encoders from USC2 to ascii code pages are consistant and do the right thing. To do wchar_t* to char* and back requires a third party encoder. IBM has an open source one. I don't remember the name. BTW, scripting languages such as Lua and Python will have a Unicode implementation based on the wchar_t of the compiler that it is built with. C# is always USC2 no matter what platform. The moral of the story...stick with QT.
C++ does not have encoding built in.
Bookmarks