-
-
Notifications
You must be signed in to change notification settings - Fork 69
Clarify None case in bstr::decode_utf8 #139
Copy link
Copy link
Open
Labels
docDocumentation should be improved.Documentation should be improved.
Description
Thank you for this useful library.
In bstr 1.0.1, the documentation for bstr::decode_utf8 states:
When unsuccessful,
Noneis returned along with the number of bytes that make up a maximal prefix of a valid UTF-8 code unit sequence. In this case, the number of bytes consumed is always between 0 and 3, inclusive, where 0 is only returned whensliceis empty.
bstr::decode_utf8(b"\xFFabc") returns (None, 1). The byte \xFF cannot be decoded so the result is None; but the number of bytes that make up a maximal prefix of a valid UTF-8 code unit sequence would be 0, as \xFF is not a valid UTF-8 prefix.
Can you confirm, or can you paraphrase the wording for me?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
docDocumentation should be improved.Documentation should be improved.