Skip to content

Returns the first UTF-8 character that cannot be converted to UCS-2 - #24

Open
bmickael wants to merge 1 commit into
rust-osdev:mainfrom
bmickael:main
Open

bmickael wants to merge 1 commit into
rust-osdev:mainfrom
bmickael:main

Conversation

@bmickael

Copy link
Copy Markdown

Hello, I am submitting this merge request because I find it more practical to know which UTF-8 character could not be converted in the event of an error.

I tried to adhere as closely as possible to the crate's philosophy; #nostd and const fn aren't areas I work with on a daily basis.

@phip1611
phip1611 self-requested a review August 10, 2026 16:56
@phip1611

Copy link
Copy Markdown
Member

thanks, will take a look soon! by the way, your commiter email <toto@toto21.com> seems not to be linked with your github account - intentional? @bmickael

@phip1611 phip1611 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple things are going on here, this should be multiple commits. Also many changes are missing the corresponding motivation.

I asked Claude for assistance here and it sais: the misplaced paren in offset + 2 & 0x3f masks the index instead of the byte, which silently corrupts decoding for any 4-byte char at offset ≥ 62 and can hit unreachable_unchecked (UB), so it needs that fix plus a non-zero-offset test before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants