module
Minecraft::NBT
Defined in:
minecraft/nbt.crClass Method Summary
- .modified_utf8_decode(bytes : Bytes) : String
-
.modified_utf8_encode(s : String) : Bytes
Minecraft NBT strings use Java's "Modified UTF-8": supplementary codepoints are written as a UTF-16 surrogate pair (each surrogate encoded in 3 bytes), and NUL is written as the two-byte overlong 0xC0 0x80.
Class Method Detail
def self.modified_utf8_encode(s : String) : Bytes
#
Minecraft NBT strings use Java's "Modified UTF-8": supplementary codepoints are written as a UTF-16 surrogate pair (each surrogate encoded in 3 bytes), and NUL is written as the two-byte overlong 0xC0 0x80. Plain UTF-8 corrupts such strings, so we encode/decode explicitly.