UCS-2 to ASCII

U

Ulrich Eckhardt

test said:
I'm trying to convert UCS-2 code to ASCII. Does anyone have an example in
C?.

for( i=0; i!=len; ++i)
if( (ucs2>=0) && (ucs2<127))
ascii = ucs2;
else
conversion_failed();
ascii = '\0';

Yes, not all UCS-2 can be converted to ASCII.
Yes, character code 127 is not part of ASCII.

Uli
 
C

Clark S. Cox III

test said:
I'm trying to convert UCS-2 code to ASCII. Does anyone have an example in C?.

for( i=0; i!=len; ++i)
if( (ucs2>=0) && (ucs2<127))
ascii = ucs2;
else
conversion_failed();
ascii = '\0';

Yes, not all UCS-2 can be converted to ASCII. Yes, character code 127
is not part of ASCII.


[OT]
According to ISO-646 and ISO-10646, character 127 is the "DEL" control
character, and is indeed part of both ASCII and Unicode.
[/OT]
 
S

SM Ryan

# Yes, character code 127 is not part of ASCII.

Rubout character.

In the good old days of paper tape, you couldn't remove a mistake. Instead you
backed up and punched all columns. The resulting all ones code (31, 63, 127, or
255) was a signal that character position was supposed to be ignored.
 
V

Villy Kruse

# Yes, character code 127 is not part of ASCII.

Rubout character.

In the good old days of paper tape, you couldn't remove a mistake. Instead you
backed up and punched all columns. The resulting all ones code (31, 63, 127, or
255) was a signal that character position was supposed to be ignored.

That was, by the way, 127 plus even parity on 8 channel paper tape.


Villy
 
Joined
Jun 23, 2009
Messages
1
Reaction score
0
convert ASCII code to UCS2

Hi All;
Can somebody post a code to convert ASCII code to UCS2. Does anyone have an example in C?.
waiting for a reply..........
 

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,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top