Results 1 to 11 of 11

Thread: Two Byte character Support

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Two Byte character Support

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Two Byte character Support

    Is it really a Qt-related question?

  3. #3
    Join Date
    Jul 2008
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Two Byte character Support

    yeah, i have to convert w_char_t* to char* and wchar_t* to LPSTR.
    please help me out.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Two Byte character Support

    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...

  5. #5
    krsmichael Guest

    Default Re: Two Byte character Support

    Quote Originally Posted by wysota View Post
    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.

Similar Threads

  1. Installation Problem
    By QbelcorT in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd April 2010, 09:04
  2. Qt-4.4.0 installation error in linux
    By babu198649 in forum Installation and Deployment
    Replies: 4
    Last Post: 27th May 2008, 14:35
  3. Access to PostgreSQL DB on a linux server
    By rmagro in forum Qt Programming
    Replies: 28
    Last Post: 13th March 2008, 09:02
  4. Qt 4.4.0 make problem
    By MarkoSan in forum Installation and Deployment
    Replies: 24
    Last Post: 22nd January 2008, 17:58
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.