How to decipher text encoding
The second most (6.7%) used encoding is ISO-8859-1. Var streamReader = new StreamReader(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true), detectEncodingFromByteOrderMarks: true) Public static string ReadAsString(this Stream stream) This works for me: public static class StreamExtension If someone is looking for a 93.9% solution.
#HOW TO DECIPHER TEXT ENCODING CODE#
The detectEncodingFromByteOrderMarks, on the StreamReader constructor, works for UTF8 and other unicode marked files, but I'm looking for a way to detect code pages, like ibm850, windows1252. Is there a way to (automatically) detect the codepage of a text file? When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage. In our application, we receive text files (.