-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix convert from UTF-8 to Unicode #123
Conversation
src/canvas/font.cpp
Outdated
@@ -331,19 +331,24 @@ uint16_t NanoFont::unicode16FromUtf8(uint8_t ch) | |||
{ | |||
#ifdef CONFIG_SSD1306_UNICODE_ENABLE | |||
static uint16_t unicode = 0; | |||
ch &= 0x00FF; | |||
if ( !unicode ) | |||
static uint8_t rest = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest should not be static and must be placed in if (ch & 0x40)
branch
src/canvas/font.cpp
Outdated
@@ -331,19 +331,24 @@ uint16_t NanoFont::unicode16FromUtf8(uint8_t ch) | |||
{ | |||
#ifdef CONFIG_SSD1306_UNICODE_ENABLE | |||
static uint16_t unicode = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it is better to move unicode
variable inside if (ch & 0x80)
branch. Please, check clang compiler results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 compilation warnings on clang
Thanks for your warning. I have made the changes.
|
Before this, we can only display U+0000 to U+07EE, since only 1-byte and 2-byte UTF-8 characters were considered. After this, we can use U+0000 to U+FFFF.
This Pull Request is made to solve issue #122