mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
enforce utf-8 encoding via nl_langinfo check #89
This commit is contained in:
parent
f0e81ea814
commit
08d4765dc4
@ -9,6 +9,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <langinfo.h>
|
||||
#include <sys/poll.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -622,6 +623,12 @@ make_nonblocking(FILE* fp){
|
||||
}
|
||||
|
||||
notcurses* notcurses_init(const notcurses_options* opts){
|
||||
const char* encoding = nl_langinfo(CODESET);
|
||||
if(encoding == NULL || strcmp(encoding, "UTF-8")){
|
||||
fprintf(stderr, "Encoding (\"%s\") wasn't UTF-8, refusing to start\n",
|
||||
encoding ? encoding : "none found");
|
||||
return NULL;
|
||||
}
|
||||
struct termios modtermios;
|
||||
notcurses* ret = malloc(sizeof(*ret));
|
||||
if(ret == NULL){
|
||||
|
Loading…
Reference in New Issue
Block a user