notcurses_init(): mention setlocale in error

If notcurses_init() fails due to a bad encoding, it's
probably because someone didn't call setlocale(3).
Make a suggestion in the error message. Resolves #414.
This commit is contained in:
nick black 2020-03-21 20:28:50 -04:00
parent 060c0c2a47
commit fbd222b04a

View File

@ -843,7 +843,7 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
}
const char* encoding = nl_langinfo(CODESET);
if(encoding == NULL || (strcmp(encoding, "ANSI_X3.4-1968") && strcmp(encoding, "UTF-8"))){
fprintf(stderr, "Encoding (\"%s\") was neither ANSI_X3.4-1968 nor UTF-8, refusing to start\n",
fprintf(stderr, "Encoding (\"%s\") was neither ANSI_X3.4-1968 nor UTF-8, refusing to start\n Did you call setlocale()?\n",
encoding ? encoding : "none found");
return NULL;
}