UCS-2 and UTF-8 conversion

This is a discussion on UCS-2 and UTF-8 conversion within the C Programming forums, part of the General Programming Boards category; Hello everyone, I am writing a pure C/C++ program to convert from UCS-2 to UTF-8 character string. I can not ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    UCS-2 and UTF-8 conversion

    Hello everyone,


    I am writing a pure C/C++ program to convert from UCS-2 to UTF-8 character string. I can not find enough information from Google -- the mapping tables (formula) between UCS-2 and UTF-8.

    I want to develop the program through pure bit operations (&, | and shifting), and I do not want to invoking any OS specific APIs.

    Any reference samples or the mapping tables (formula) between UCS-2 and UTF-8?


    thanks in advance,
    George

  2. #2
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116
    Maybe you could look in the source code of ICU (IBM's open source library for Unicode).

  3. #3
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    http://en.wikipedia.org/wiki/UCS-2
    http://en.wikipedia.org/wiki/Utf-8

    Wikipedia has good enough info. I've written Unicode converters with it's help.

  4. #4
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116
    BTW why write a converter isn't the free libraries cover that functionality.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21