Decodes bytes with the given encoding. For "binary" and "ascii" replaces non-printable bytes with '.'. Returns null if encoding fails (only can fail utf-8, utf-16le, utf-16be).
decode(bytes, "utf-8") → "Hello" | null Copy
decode(bytes, "utf-8") → "Hello" | null
decode(bytes, "binary") → always string, never null Copy
decode(bytes, "binary") → always string, never null
Decodes bytes with the given encoding. For "binary" and "ascii" replaces non-printable bytes with '.'. Returns null if encoding fails (only can fail utf-8, utf-16le, utf-16be).