How to convert to another encoding?

Discussion in 'C++' started by Vlad, Apr 8, 2004.

  1. Vlad

    Vlad Guest

    I have one problem. The company uses files with contents in German
    language but stored in Central European DOS-encoding (852). The
    problem is to write a program which converts it to windows-1252
    encoding (default encoding on m machine).
    I wrote a simple code (VC++):

    ifstream old;
    locale loc("German_Germany.852");
    old.imbue(loc);
    old.open(oldName);

    ofstream newf(newName);
    newf << old.rdBuf();

    newf.close();
    old.close();

    But it doesn't convert anything!
    What's wrong?
     
    Vlad, Apr 8, 2004
    #1
    1. Advertising

  2. Vlad

    tom_usenet Guest

    On 8 Apr 2004 05:31:07 -0700, (Vlad) wrote:

    >I have one problem. The company uses files with contents in German
    >language but stored in Central European DOS-encoding (852). The
    >problem is to write a program which converts it to windows-1252
    >encoding (default encoding on m machine).
    >I wrote a simple code (VC++):
    >
    >ifstream old;
    >locale loc("German_Germany.852");
    >old.imbue(loc);
    >old.open(oldName);
    >
    >ofstream newf(newName);
    >newf << old.rdBuf();
    >
    >newf.close();
    >old.close();
    >
    >But it doesn't convert anything!
    >What's wrong?


    Perhaps your compiler doesn't have the relevent encoding codecvt
    facet. The relevant one can be found in Dinkumware's libcoreX:
    http://www.dinkumware.com/libDCorX.html.

    Tom
    --
    C++ FAQ: http://www.parashift.com/c -faq-lite/
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
     
    tom_usenet, Apr 8, 2004
    #2
    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. Hardy Wang

    Encoding.Default and Encoding.UTF8

    Hardy Wang, Jun 8, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    18,867
    Jon Skeet [C# MVP]
    Jun 9, 2004
  2. Replies:
    1
    Views:
    23,369
    Real Gagnon
    Oct 8, 2004
  3. Replies:
    1
    Views:
    565
    gene tani
    Dec 20, 2005
  4. =?Utf-8?B?U3RlcGhhbmU=?=

    Convert google querystring encoding

    =?Utf-8?B?U3RlcGhhbmU=?=, Oct 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    378
    =?Utf-8?B?U3RlcGhhbmU=?=
    Oct 5, 2006
  5. Replies:
    2
    Views:
    373
Loading...

Share This Page