diff --git a/src/components/BinaryInput.tsx b/src/components/BinaryInput.tsx index fb910cf..4a6337e 100644 --- a/src/components/BinaryInput.tsx +++ b/src/components/BinaryInput.tsx @@ -162,13 +162,7 @@ const textDecoder = new TextDecoder("utf-8", { fatal: true }) export const bytesToString = (value: Binary) => { try { const bytes = value.asBytes() - const nullPos = bytes.indexOf(0) - // if there's a null character (except at the end of the text) we want hex - if ( - bytes.length === 0 || - (nullPos !== -1 && (bytes.length === 1 || nullPos !== bytes.length - 1)) - ) - throw null + if (bytes.slice(0, 5).every((b) => b < 32)) throw null return textDecoder.decode(bytes) } catch (_) { return value.asHex()