file-encodings

StreamWriter and UTF-8 Byte Order Marks

杀马特。学长 韩版系。学妹 提交于 2019-11-27 01:39:20
I'm having an issue with StreamWriter and Byte Order Marks. The documentation seems to state that the Encoding.UTF8 encoding has byte order marks enabled but when files are being written some have the marks while other don't. I'm creating the stream writer in the following way: this.Writer = new StreamWriter(this.Stream, System.Text.Encoding.UTF8); Any ideas on what could be happening would be appreciated. As someone pointed that out already, calling without the encoding argument does the trick. However, if you want to be explicit, try this: using (var sw = new StreamWriter(this.Stream, new

StreamWriter and UTF-8 Byte Order Marks

旧街凉风 提交于 2019-11-26 17:28:27
问题 I'm having an issue with StreamWriter and Byte Order Marks. The documentation seems to state that the Encoding.UTF8 encoding has byte order marks enabled but when files are being written some have the marks while other don't. I'm creating the stream writer in the following way: this.Writer = new StreamWriter(this.Stream, System.Text.Encoding.UTF8); Any ideas on what could be happening would be appreciated. 回答1: As someone pointed that out already, calling without the encoding argument does

File.listFiles() mangles unicode names with JDK 6 (Unicode Normalization issues)

試著忘記壹切 提交于 2019-11-26 10:43:58
问题 I\'m struggling with a strange file name encoding issue when listing directory contents in Java 6 on both OS X and Linux: the File.listFiles() and related methods seem to return file names in a different encoding than the rest of the system. Note that it is not merely the display of these file names that is causing me problems. I\'m mainly interested in doing a comparison of file names with a remote file storage system, so I care more about the content of the name strings than the character