Skip to content

Commit

Permalink
setlocale in demo
Browse files Browse the repository at this point in the history
since around cd42ba3, we rely on `iswprint`, which itself is
locale-dependent. callers using unicode (like the demo) must be sure
to set a unicode locale prior to initializing.
  • Loading branch information
adsr committed Oct 4, 2024
1 parent a890dbc commit 43d40b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demo/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <stdio.h>
#include <locale.h>
#include "../termbox2.h"

struct key {
Expand Down Expand Up @@ -694,6 +695,8 @@ int main(int argc, char **argv)
(void) argc; (void) argv;
int ret;

setlocale(LC_ALL, "");

ret = tb_init();
if (ret) {
fprintf(stderr, "tb_init() failed with error code %d\n", ret);
Expand Down

0 comments on commit 43d40b6

Please sign in to comment.