How to convert to another encoding?

V

Vlad

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?
 
T

tom_usenet

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
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top