Hello everybody,
I receive a text file written by PowerShell with Export-CSV, with no precision of character set, on a Windows French system, so I presume we have a character page of 850 or 1252.
I want to read it from a WinForms application that has to load the contents to a ListBox. But if I attempt to use the character set pages I said, I get an error:
And ... I do not intend to redefine the basic sorts of files, that already existed before Windows was invented, and are daily used since, particularly in console applications.
So, I began by listing the supported character sets :
and in the output I obtained this :
Well, is not it possible to read an OEM text file in WinForms, with accentuated characters ?
I should guess I already did.
Do I have anything more to declare first ?
I receive a text file written by PowerShell with Export-CSV, with no precision of character set, on a Windows French system, so I presume we have a character page of 850 or 1252.
I want to read it from a WinForms application that has to load the contents to a ListBox. But if I attempt to use the character set pages I said, I get an error:
Error message : encoding not recognized:
"System.NotSupportedException : 'No data is available for encoding 850. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.'"
And ... I do not intend to redefine the basic sorts of files, that already existed before Windows was invented, and are daily used since, particularly in console applications.
So, I began by listing the supported character sets :
Reading the existing encodings:
EncodingInfo[] listenc = Encoding.GetEncodings();
foreach(EncodingInfo inf in listenc)
{
System.Diagnostics.Debug.Print("{0} : {1}", inf.CodePage, inf.DisplayName);
}
and in the output I obtained this :
Existing encodings obtained by previous code extract:
1200 : Unicode
1201 : Unicode (Big-Endian)
12000 : Unicode (UTF-32)
12001 : Unicode (UTF-32 Big-Endian)
20127 : US-ASCII
28591 : Western European (ISO)
65001 : Unicode (UTF-8)
Well, is not it possible to read an OEM text file in WinForms, with accentuated characters ?
I should guess I already did.
Do I have anything more to declare first ?