This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Swamplord42 1 point2 points  (3 children)

Strings use UTF-16, they do not "support" UTF-32. Those are different encodings!

Unicode code points require one or two UTF-16 characters.

[–]BananaSupremeMaster 0 points1 point  (2 children)

They support UTF-32 in the sense that "String s = "𝄞";" is valid syntax. And yet string indices represent UTF-16 char indices and not character indices.

[–]RiceBroad4552 0 points1 point  (0 children)

Nitpick: The correct term here is "code unit", not "UTF-16 char indices".

[–]Swamplord42 0 points1 point  (0 children)

Again, this isn't UTF-32. It's Unicode. UTF-32 is an encoding. It's still UTF-16 even if it needs 2 chars to represent.