c++windowsunicodecp1250iso-8859-2

Rewrite txt file into other encoding


I have a problem. I want to rewrite txt file into other txt file, but with other encoding. I must implement conversion to Unicode, iso-8859 and windows-1250.

I must write it in c++. Can anyone help me with this topic? How to start coding this?

Best regards!


Solution

  • Windows is perfectly capable of doing string conversions for you. Read data from the source file and pass it to MultiByteToWideChar specifying the source codepage, then pass that output to WideCharToMultiByte specifying the target codepage and write that output to the target file.

    BTW, next question state up front that you're working on Windows only. Don't put useful information like that in a comment.