The file is in UTF-8, but you are viewing it in single-byte encoding:
- You see UTF-8 multibyte sequences for special characters with char for each byte.
Make sure you read it as UTF-8, because you really use non-ASCII, comma, quotation marks, and Japanese. So UTF-8 is fine.
Windows dirty trick:
String string = "\uFEFF##...
This writes the Unicode char specification, which, being the first char of a file, is interpreted as a Unicode token.
Otherwise, create an HTML file with the specified encoding:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body><pre>...</pre></body></html>
Display on the System.out console is not possible on a system other than UTF-8, such as Windows.
Also, so that your application is portable, make sure that you specify the encoding for the record; it is often an optional argument, with an overridden method / constructor.
source share