Thread: UCS-2 and UTF-8 conversion

  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
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    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