Convert Unicode Codepoint(dec) value to ASCII char in C++(Linux)?

Discussion in 'C++' started by Aneesh E Warrier, Dec 5, 2006.

  1. How can I convert Unicode Codepoint (dec) value to ASCII char?

    For example: 49324 is 사 a Korean alphabet, and I want to convert it
    to ASCII letter.

    Thanks!
     
    Aneesh E Warrier, Dec 5, 2006
    #1
    1. Advertising

  2. Aneesh E Warrier wrote:
    > How can I convert Unicode Codepoint (dec) value to ASCII char?
    >
    > For example: 49324 is 사 a Korean alphabet, and I want to convert it
    > to ASCII letter.
    >
    > Thanks!
     
    Aneesh E Warrier, Dec 5, 2006
    #2
    1. Advertising

  3. Aneesh E Warrier

    TvN Guest

    Aneesh E Warrier wrote:
    > How can I convert Unicode Codepoint (dec) value to ASCII char?
    >
    > For example: 49324 is 사 a Korean alphabet, and I want to convert it
    > to ASCII letter.
    >


    Take a look at iconv. man 3 iconv under Linux ;)

    Regards,
    Volodymyr!
     
    TvN, Dec 5, 2006
    #3
  4. ------> Take a look at iconv. man 3 iconv under Linux ;) -----

    iconv converts a character string, my input is only Unicode Codepoint
    (dec) for one character say 49324.

    is there any way to get the Unicode character associated with the
    Codepoint.

    Thanks,
    Aneesh
     
    Aneesh E Warrier, Dec 5, 2006
    #4
  5. Aneesh E Warrier

    Guest

    Aneesh E Warrier schreef:

    > How can I convert Unicode Codepoint (dec) value to ASCII char?


    Not really a C++ problem, I guess. Basically, wrting any C++ program
    requires
    two steps. What does it need to do, and how do you do that in C++?

    > For example: 49324 is 사 a Korean alphabet, and I want to convert it
    > to ASCII letter.


    Ok - how would you do it without a computer? In this case, the answer
    is easy.
    You can't. ASCII was designed for Americans, and they don't need Korean
    characters, so there is no ASCII number assigned. So you'd replace it
    with
    a '?'. Ok, now you should be able to figure out how to write the C++
    for that -
    please show us and we'll help you from there.

    Michiel
     
    , Dec 5, 2006
    #5
  6. I want to convert the number 49324 to its Unicode equivalent char (사)


    I want something like following:

    < char out =
    someFunc(49324); >

    Is there any way to get the char value of that Codepoint(dec)?

    Thanks,
    Aneesh
     
    Aneesh E Warrier, Dec 5, 2006
    #6
  7. Aneesh E Warrier

    Guest

    Aneesh E Warrier schreef:

    > I want to convert the number 49324 to its Unicode equivalent char (사)


    In C++, the number IS the char. e.g. if char is ASCII, then char(65) ==
    'A'
    And again, assuming char is ASCII, there is no char(49324). There may
    be
    a wchar_t(49324), e.g. if wchar_t is Unicode. That's independent from
    whether
    char is ASCII. C++ implementations differ, so check your manual.

    HTH,
    Michiel Salters
     
    , Dec 5, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    420
    =?iso-8859-1?q?Kirit_S=E6lensminde?=
    Jan 5, 2007
  2. JR
    Replies:
    7
    Views:
    688
    Greg R. Broderick
    Jul 6, 2007
  3. James Kanze
    Replies:
    2
    Views:
    454
    James Kanze
    Dec 26, 2009
  4. Gilles Gilles
    Replies:
    5
    Views:
    324
    Gilles Devaux
    Feb 17, 2011
  5. J.E./C.Y.Cripps
    Replies:
    0
    Views:
    132
    J.E./C.Y.Cripps
    Dec 3, 2004
Loading...

Share This Page