Results 1 to 11 of 11

Thread: Two Byte character Support

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

    Default Two Byte character Support

    How two byte support can be done.

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

    Default Re: Two Byte Support.

    Quote Originally Posted by rajveer View Post
    How two byte support can be done.
    Please be more specific and stop spamming me with same private messages all over or you'll start receiving infractions for spamming.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Two Byte character Support

    Did you see QChar ?

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

    Default conversion

    1 how can this conversion done:

    a) wchar_t* to char*
    b) wchar_t* to LPSTR

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

  6. #6
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: conversion

    If you insist on a Qt based solution, have a look at QString::fromWCharArray() and QString::toLatin1() etc.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Two Byte character Support

    {merged two and a half thread}

    Please, don't start more than one thread on the same topic.

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

    Default Re: Two Byte character Support

    Is it really a Qt-related question?

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

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    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...

  11. #11
    Join Date
    Jan 2006
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.