utility to convert from ansi to unicode

E

emagzz

Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

Thank you
Emanuele
 
C

CBFalconer

emagzz said:
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

short int widechar;
unsigned char ch;

do {
ch = getnext();
widechar = ch;
putwide(widechar);
while (ch);

assuming (sizeof(short) > 1) and that strings are '\0' terminated.
No worries about endianess with the above. Depends on the known
range of ANSI chars.
 
J

Jens Thoms Toerring

emagzz said:
I need to convert many text file from ANSI to UNICODE.

If the files are "clean" ANSI and you want to go to UTF-8 no
conversion is needed.
Some body knows if there is a free utility that can do this from the
command line so as I can use it inside a batch file.

What makes you think that a newsgroup about the C programming
laguage would be a good place to ask this?

<off topic>
See e.g. http://www.gnu.org/software/recode/recode.html
</off topic>
Regards, Jens
 
L

Leslie Kis-Adam

emagzz said:
Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

Thank you
Emanuele

Umm. I think it's a little bit off-topic. 8-|

Laszlo Kis-Adam
 
K

Keith Thompson

emagzz said:
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

What do you mean by ANSI? (That's the name of the US standards body;
there are a plethora of ANSi standards.)

If you mean ASCII, that's a 7-bit code. There are several encodings
of Unicode. And I don't think this is the right newsgroup for your
question anyway; I'm not entirely sure what is. Perhaps
comp.programming?
 
K

Keith Thompson

CBFalconer said:
short int widechar;
unsigned char ch;

do {
ch = getnext();
widechar = ch;
putwide(widechar);
while (ch);

assuming (sizeof(short) > 1) and that strings are '\0' terminated.
No worries about endianess with the above. Depends on the known
range of ANSI chars.

What the heck is "putwide"? There's no such function in standard C.
In fact, there appears to be no such function at all. A Google search
turned up just one hit, and that appears to be the result of some
blanks being left out of an old index on docs.sun.com.
 
R

Richard Tobin

I need to convert many text file from ANSI to UNICODE.
[/QUOTE]
What do you mean by ANSI? (That's the name of the US standards body;
there are a plethora of ANSi standards.)

He probably means the Windows 1252 encoding, commonly known
(apparently) as "ANSI"[*]. It's the same as ISO Latin-1, but with a
random bunch of printable characters instead of the C1 controls. If
it was Latin-1, the conversion to Unicode would be trivial, since the
code points are the same, but it isn't, so it isn't.

[*] I think it stands for "A Non-Standard Incoding".

-- Richard
 
C

CBFalconer

Keith said:
What the heck is "putwide"? There's no such function in standard C.
In fact, there appears to be no such function at all. A Google search
turned up just one hit, and that appears to be the result of some
blanks being left out of an old index on docs.sun.com.

getnext and putwide are shorthand for whatever the OP wants to do
to get the input and dump the output. I thought it was obvious.
Guess not.
 
K

Kenny McCormack

CBFalconer said:
getnext and putwide are shorthand for whatever the OP wants to do
to get the input and dump the output. I thought it was obvious.
Guess not.

*Nothing* is obvious to KT. The guy is dumber than three bags of
hammers.
 
N

Nelu

emagzz said:
Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

This is off-topic here.

On my Linux system there's a utility called uniconv. *man
unicode* will tell you what it does. You can either ask in a
unicode group if there is one or a Linux/UNIX group. I don't know
if the utility exists for other environments and I have no idea
how it works. I heard about it when I was switching gentoo to UTF-8.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top