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

  • Thread starter Aneesh E Warrier
  • Start date
A

Aneesh E Warrier

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!
 
A

Aneesh E Warrier

Aneesh said:
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!
 
T

TvN

Aneesh said:
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!
 
A

Aneesh E Warrier

------> 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
 
M

Michiel.Salters

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
 
A

Aneesh E Warrier

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
 
M

Michiel.Salters

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top