microsoft / vscode-hexeditor

VS Code Hex Editor
https://marketplace.visualstudio.com/items?itemName=ms-vscode.hexeditor
MIT License
525 stars 85 forks source link

UTF-8 data on the data inspector can decode text longer than one byte #462

Closed juls0730 closed 10 months ago

juls0730 commented 10 months ago

Issue summary

If you have bytes that form text in some sort of bespoke two-byte UTF-8, the data inspector will give you incorrect data.

Environment

Steps to reproduce

  1. open a file with the hex editor
  2. Write two bytes, in my case, 0xDD and 0x9F
  3. Highlight the 0xDD bytes
  4. Decoded text shows .., but the data inspector shows ݟ

Expected behavior: The data inspector should show nothing, as 0xDD corresponds to nothing in UTF-8 Actual behavior: The data inspector shows ݟ for the UTF-8 data

connor4312 commented 10 months ago

0xDD 0x9F is a code point for U+075F, which is a valid character.

The UTF-8 view is intended to show the UTF-8 code point starting at the selected byte, when valid. That seems to be working based on your description.

juls0730 commented 10 months ago

@connor4312 oh, so it is, I'm so sorry for wasting your time.