473,395 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to convert to another encoding?

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?
Jul 22 '05 #1
2 2924
On 8 Apr 2004 05:31:07 -0700, vl************@mail.ru (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
Jul 22 '05 #2
On 8 Apr 2004 05:31:07 -0700, vl************@mail.ru (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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
2
by: Vlad | last post by:
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...
5
by: DbNetLink | last post by:
I am trying to convert some Japanese text encoded as Shift-JIS/ISO-2022-JP to UTF-8 so I can store all data in my database with a common encoding. My problem is the encoding conversion code works...
3
by: Rodusa | last post by:
I am looking for an example of how to save a DataTable into Base64 and vice-versa. I tried using Convert.ToBase64String(), but it says that it cannot convert DataTable to byte. Any help or pointing...
3
by: Jan Eliasen | last post by:
Hi I have a string, which I must convert into another string and have it utf-8 encoded. My current code looks like this; Both vDataIn and vDataOut are Objects (parameters to a...
3
by: iwdu15 | last post by:
hi, how can i convert rtf encoding to HTML? i looked at previous posts and i cant seem to find the HTTPUtility in vbexpress 2005. Is it not there, and is there another way? thanks -- -iwdu15
3
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what...
3
by: shapper | last post by:
Hello, Could someone tell me how to convert a XML file into another XML file using a XSL file with a parameter? I created the code to do it, and it seems ok, but it is not working. Could...
4
by: Franky | last post by:
I have a Command Prompt window open and select all the characters and copy them to the clipboard. I then read them from the clipboard str = CType(DataO.GetData(DataFormats.OemText, False),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.