By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

UNICODE to ASCII Conversion

P: 10
Hi All,

I'm writing a program, part of which needs to read text from a .log file in UNICODE line by line, then convert it to ASCII and write it to an ASCII .log file line by line...

I've been battling with this issue for a week, and have yet to find a solution.

PS: I'm writing in C

Thanks a lot

Alex
Sep 18 '06 #1
Share this Question
Share on Google+
3 Replies


P: 10
People please give me some clues on how to do it.

sample code would be great.

Thanks a lot
Sep 21 '06 #2

100+
P: 144
Do you know what Unicode encoding you need to read in (ie. UTF-8 or UTF-16)? Linux systems use UTF-8 which has the nice side effect that ASCII characters have the same representation in UTF-8. Windows uses UTF-16, and I'm not sure whether or not UTF-16 has the same side effect.
Sep 21 '06 #3

100+
P: 293
D_C
UNICODE supports every single language. Will your program need to do the same? Each language gets the minimum number of entries (always a multiple of 16) to store their characters. Some languages have escape sequences, some do not. Is everything going to be translated to English?

It's no longer trivial if you have those considerations. However, if you are doing from English to English, maybe it's not so bad. Just find the cuts off for all the dialects, and then you may need to use logical and to clear certain bits, and also slide the characters over to line up.

If the characters are somehow not arranged a-z, then that might be trouble.
Sep 22 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.