On Tue, 28 Aug 2007 06:43:02 -0700, Jon Skeet [C# MVP] wrote:
On Aug 28, 2:19 pm, Bjarne Nielsen <bniel...@post11.tele.dkwrote:
>In my C# program I need to read a file, which is exported from a DOS
program. So words such as "Afløser" (with special danish characters) is
read like "Afl?ser".
How do I decode/encode DOS formatted strings to the right ".net" format.
Find out which code page your file is in - it may be 437, but it may
not be - different systems used different code pages.
When you know the code page, use Encoding.GetEncoding(codePage) and
then supply that whatever method you're using to read the file.
Jon
Thank you Jon and Ciccone
It took me quite some time to make it work, until I realised, that I needed
two different encodings, one for reading the file, and another for writing
back to the new file (it's a file conversion program).
But with your help and a lot of patience and fooling around, I got it to
work.
Thanks!