MatMoore / MatMoore/string-inspector
Investigate potential issue with high code points
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The formatting code currently assumes that the byte representation in hex, with spaces between bytes (`format_bytes()`) is always longer than the unicode code point in hex (`format_character()`).
For example, for the character U+1f4a9 in UTF-8 we have f0 9f 92 a9 (a width of 12) which is longer than 1f4a9 (a width of 5).
This makes sense for single byte encodings and unicode encodings but I suspect there may be exceptions.
If so, a `DecodedCharacer`'s `width()` should be the larger of the two.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating format_bytes(), format_character(), and DecodedCharacer::width() in the Rust CLI. Check whether characters with high Unicode code points can make the formatted code-point width exceed the spaced UTF-8 byte width. Done means width uses the larger value when such an exception exists, with behavior confirmed for the U+1f4a9 example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100