←back to thread

238 points GalaxySnail | 1 comments | | HN request time: 0s | source
Show context
Macha ◴[] No.40168944[source]
> And many other popular programming languages, including Node.js, Go, Rust, and Java uses UTF-8 by default.

Oh, I missed Java moving from UTF-16 to UTF-8.

replies(3): >>40169012 #>>40169499 #>>40169530 #
1. hashmash ◴[] No.40169530[source]
With Java, the default encoding when converting bytes to strings was originally platform independent, but now it's UTF-8. UTF-16 and latin-1 encodings are (still*) used internally by the String class, and the JVM uses a modified UTF-8 encoding like it always has.

* The String class originally only used UTF-16 encoding, but since Java 9 it also uses a single-byte-per-character latin-1 encoding when possible.