module Minecraft::NBT

Defined in:

minecraft/nbt.cr

Class Method Summary

Class Method Detail

def self.modified_utf8_decode(bytes : Bytes) : String #

[View source]
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.


[View source]