utility to convert from ansi to unicode

Discussion in 'C Programming' started by emagzz, Nov 22, 2006.

  1. emagzz

    emagzz Guest

    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
    emagzz, Nov 22, 2006
    #1
    1. Advertising

  2. emagzz

    CBFalconer Guest

    emagzz wrote:
    >
    > 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.

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>
    CBFalconer, Nov 22, 2006
    #2
    1. Advertising

  3. emagzz <> wrote:
    > 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
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
    Jens Thoms Toerring, Nov 22, 2006
    #3
  4. emagzz wrote:
    > 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
    Leslie Kis-Adam, Nov 22, 2006
    #4
  5. "emagzz" <> writes:
    > 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?

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Nov 22, 2006
    #5
  6. CBFalconer <> writes:
    > emagzz wrote:
    >>
    >> 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.


    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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Nov 22, 2006
    #6
  7. In article <>,
    Keith Thompson <> wrote:

    >> I need to convert many text file from ANSI to UNICODE.


    >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
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
    Richard Tobin, Nov 22, 2006
    #7
  8. emagzz

    CBFalconer Guest

    Keith Thompson wrote:
    > CBFalconer <> writes:
    >> emagzz wrote:
    >>>
    >>> 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.

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

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>
    CBFalconer, Nov 22, 2006
    #8
  9. In article <>,
    CBFalconer <> wrote:
    ....
    >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.
    Kenny McCormack, Nov 23, 2006
    #9
  10. emagzz

    Nelu Guest

    emagzz wrote:
    > 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.

    --
    Ioan - Ciprian Tandau
    tandau _at_ freeshell _dot_ org (hope it's not too late)
    (... and that it still works...)
    Nelu, Nov 23, 2006
    #10
    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:
    1
    Views:
    476
  2. Replies:
    11
    Views:
    1,056
    Keith Thompson
    Apr 28, 2008
  3. Frank Iannarilli

    pre-ansi to ansi c++ conversion?

    Frank Iannarilli, Jul 21, 2009, in forum: C++
    Replies:
    2
    Views:
    404
  4. Jeremy
    Replies:
    1
    Views:
    796
    Alex Willmer
    Jan 11, 2011
  5. Jeremy
    Replies:
    0
    Views:
    566
    Jeremy
    Jan 11, 2011
Loading...

Share This Page