![]() It doesn't revert back to Encoding.Default if it can't find a byte order mark - the default without a byte order mark is UTF-8 which usually will result in invalid text parsing. It actually works but only if the content is encoded as UTF-8/16/32 - ie. StreamReader() specifically has an overload that's supposed to help with detection of byte order marks and based on that is supposed to sniff the document's encoding. It turns out part of the problem is the code I snatched from Douglas Crockford's original C# minifier code, but there's also an issue with some of the code I added to provide string translations. I posted a JavaScript Minifier application yesterday and somebody correctly pointed out that the text encoding was incorrect. ![]() StreamReader supports byte order mark detection and in most cases that seems to be working Ok, but if you deal with a variety of different file encodings for input files using the default detection comes up short. ![]() I keep running into issues in regards to auto-detection of file types when using StreamReader.
0 Comments
Leave a Reply. |