The error is in a comparison which checks for <= 0x3FF instead of <= 0x7FF (or < 0x800). This causes code points U+0400 to U+07FF to be encoded incorrectly, resulting in invalid UTF-8 sequences.
Example:
$ ./unicode U+0400
U+0400: CYRILLIC CAPITAL LETTER IE WITH GRAVE
Character: ���
Category: Letter, Uppercase
Text direction: Left-to-Right
Decomposition: Composition of U+415 and U+0300
Lowercase equivalent: U+0450
This is fixed in dsalt/Unicode@2a60b63dfb (see #1).
The error is in a comparison which checks for `<= 0x3FF` instead of `<= 0x7FF` (or `< 0x800`). This causes code points U+0400 to U+07FF to be encoded incorrectly, resulting in invalid UTF-8 sequences.
Example:
```
$ ./unicode U+0400
U+0400: CYRILLIC CAPITAL LETTER IE WITH GRAVE
Character: ���
Category: Letter, Uppercase
Text direction: Left-to-Right
Decomposition: Composition of U+415 and U+0300
Lowercase equivalent: U+0450
```
This is fixed in dsalt/Unicode@2a60b63dfb67e2c9111e422ecbfd85f5468b8d82 (see #1).