The default character encoding is
ISO-8859-1. It is thus the encoding used when:
- creating a new string from a byte array without specifying the encoding (String(byte) constructor),
- getting the byte array from a string without specifying the encoding (String.getBytes() method),
- printing a string to standard output stream (System.out),
- creating a new PrintStream without specifying the encoding.
This implementation also supports Unicode code points as supplementary characters, by setting the constant
It is possible to connect additional custom encodings. Please contact our support team for more details.
By default, the standard output stream (
ISO-8859-1 encoding to print strings. If you want to print a string with a different encoding, you can create a new
PrintStream outUtf8 = new PrintStream(System.out, true, "UTF-8"); outUtf8.println("你好");
Make sure you embed the
UTF-8 encoder (see UTF-8 Encoding)
The print methods write the raw byte array with the encoding used by the
PrintStream to the console. The console must then be configured with the same encoding to display characters properly.
Set Encoding in MicroEJ SDK Console¶
The default encoding for Eclipse consoles is
UTF-8. If your application prints non-ASCII characters, they may not be displayed properly.
The encoding used by a console for a given application can be set in the application launcher options: Run > Run Configurations…, and then Common tab > Encoding radio buttons.