fix(encodings): invalid UTF-8 decode loses data silently #33
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
flopana/OpenDevTools#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #30
Branch:
feature/improve-encodingsBugs
TextDecoderis not fatal. Base64 decode of/w==gives�with no error. Encode it again and you get77+9. The original bytes are lost.abc!, then click the toggle: the input becomes the error text.toast.errorruns insideuseMemo, during render. Each invalid keystroke fires a toast. StrictMode doubles it.SGVsbG8=+ newline fails. Base16 decode of lowercase48656c6c6fmay fail.Verification: from reading the code only. Item 4 base16 comes from memory of
@scure/base. Check it first.Red tests
/w==shows an error, not�.abc!, then toggle: the input does not hold the error text.SGVsbG8=+ newline givesHello. Base16 decode of48656c6c6fgivesHello, if it fails now.Fix
convert(input, encoding, direction)insrc/lib/Generators/Encodings.ts. It returns{success, value | error}, likeparseTimestamp.new TextDecoder("utf-8", { fatal: true }).""on error and fires the toast inuseEffect.