Skip to content

Commit

Permalink
Merge pull request #53 from FL550/master
Browse files Browse the repository at this point in the history
Fixes an issue with UTF8 characters in settings
  • Loading branch information
MaxGyver83 authored Jun 24, 2022
2 parents abd62d8 + 8a4a0fd commit ace6b1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <wchar.h>
#include <stdbool.h>
Expand Down Expand Up @@ -1568,6 +1569,11 @@ int main(int argc, char *argv[]) {
char *token = strtok(line, "=");
if (token == NULL) continue;
int keycode = (int)token[0];
uint8_t c = token[0];
//2-byte UTF sequence
if (c >> 5 == 0b110) {
keycode = (int)((token[0] << 6) & 0b0000011111000000) | ((token[1] << 0) & 0b0000000000111111);
}
token = strtok(NULL, "(");
if (token == NULL) continue;
token = strtok(NULL, ")");
Expand Down

0 comments on commit ace6b1a

Please sign in to comment.