Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to convert to another encoding?

Reply
Thread Tools

How to convert to another encoding?

 
 
Vlad
Guest
Posts: n/a
 
      04-08-2004
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?
 
Reply With Quote
 
 
 
 
tom_usenet
Guest
Posts: n/a
 
      04-08-2004
On 8 Apr 2004 05:31:07 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
IsNumeric: Convert.ToInt32 vs. Convert.ToInt64 sck10 ASP .Net 4 09-03-2006 09:40 PM
To convert to J2SE 6 or not to convert, that is the question... Jaap Java 4 07-10-2006 09:03 AM
convert list of strings to set of regexes; convert list of strings to trie Klaus Neuner Python 7 07-26-2004 07:25 AM
Do I need to Convert with Convert.ToInt32(session("myNumber")) ? Andreas Klemt ASP .Net 1 07-23-2003 02:59 PM



Advertisments