How can I convert a ISO 8859-2 to UTF?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: How can I convert a ISO 8859-2 to UTF?

  1. #1
    Join Date
    Jan 2009
    Posts
    3

    How can I convert a ISO 8859-2 to UTF?

    How can I convert a ISO 8859-2 and ISO 8859-9 to UTF in c++?
    Is there something similar in c++ as in Java ?
    In Java we can simply create a new string(oldstring, "8859-2");
    Is it that simple in c++?

    More Info:
    I am getting the name of a service provider in HEXA format in a XML file.
    After parsing the XML file I am able to extract, the HEXA string.
    But in the C++ application, I need to display the characters and not the HEXA. These characters are encoded in ISO 8859-2 and 8859-9 formats...

  2. #2
    Join Date
    Jan 2009
    Posts
    3

    Re: How can I convert a ISO 8859-2 to UTF?

    May be i could not explain the question completely,

    Lets take a character,

    For example, the ű (0xFB in ISO/IEC 8859-2, i.e. \u0171) if I do the normal HEXA to ASCII conversion I get the character but it has been replaced by the (0xFB in ISO/IEC 8859-1, i.e. \u00FB).

    So, basically, there is no conversion needed, but just a format specifier kinf of thing which convert the HEXA to corresponding characters as per the encoding table.

    In JAVA, we have something like,

    new String(AB); // AB (because default encoding on our system is ISO/IEC 8859-1)

    new String(AB, 8859-1); // AB

    new String(AB, 8859-2); // ABű (see the difference with lines above, for the u char)

    Quote Originally Posted by focussed View Post
    How can I convert a ISO 8859-2 and ISO 8859-9 to UTF in c++?
    Is there something similar in c++ as in Java ?
    In Java we can simply create a new string(oldstring, "8859-2");
    Is it that simple in c++?

    More Info:
    I am getting the name of a service provider in HEXA format in a XML file.
    After parsing the XML file I am able to extract, the HEXA string.
    But in the C++ application, I need to display the characters and not the HEXA. These characters are encoded in ISO 8859-2 and 8859-9 formats...

  3. #3
    Join Date
    Nov 2003
    Posts
    1,822

    Re: How can I convert a ISO 8859-2 to UTF?

    What OS and where are you displaying the characters - console or GUI?

    gg

  4. #4
    Join Date
    Jan 2009
    Posts
    3

    Re: How can I convert a ISO 8859-2 to UTF?

    I am using windows and I am trying to display the characters on GUI..
    the application is developed using Builder C++...

    Quote Originally Posted by Codeplug View Post
    What OS and where are you displaying the characters - console or GUI?

    gg

  5. #5
    Join Date
    Nov 2003
    Posts
    1,822

    Re: How can I convert a ISO 8859-2 to UTF?

    ISO code page values for Windows: http://www.microsoft.com/globaldev/reference/iso.mspx
    All code page values for Windows: http://msdn.microsoft.com/en-us/libr...46(VS.85).aspx

    ISO 8859-2 = windows code page 28592
    ISO 8859-9 = windows code page 28599

    A WCHAR (or wchar_t) in Windows is a 2 byte Unicode code point using UTF16 encoding. To convert a char string from a given code page to UTF16 (WCHAR) string, you use MultiByteToWideChar().

    Support for UTF16 strings in the Windows API is enabled by defining UNICODE (and _UNICODE for the MS CRT). I don't know what else may be needed for C++ Builder and its libraries.

    gg

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center