Probably what I said is an unnecessary complication.
I was just thinking might there be some systems which get the locale information from elsewhere, such as MS Windows getting it from the registry (uses locale strings like English_USA.1252 etc. without needing anything in the environment).
So ...
Search found 4 matches
- Fri May 31, 2013 7:46 pm
- Forum: AES Crypt
- Topic: setlocale to allow UTF-8 characters on command line
- Replies: 6
- Views: 13862
- Fri May 31, 2013 8:51 am
- Forum: AES Crypt
- Topic: setlocale to allow UTF-8 characters on command line
- Replies: 6
- Views: 13862
Re: setlocale to allow UTF-8 characters on command line
I see that setlocale() can also query the current locale by using a NULL arg. So it might be worth querying it first and only setting it if was the default "C" locale - since if there is no LANG environment variable set then setlocale(LC_ALL,"") would set it to "C" when there might have been a ...
- Thu May 30, 2013 6:01 pm
- Forum: AES Crypt
- Topic: setlocale to allow UTF-8 characters on command line
- Replies: 6
- Views: 13862
Re: setlocale to allow UTF-8 characters on command line
Yes, I added the setlocale() call and it works on both Linux and Cygwin/Windows for UTF-8 passwords. I can encrypt a file on one O/S and decrypt it on the other O/S using the same UTF-8 password string.
The LIBS is also needed on Cygwin, but you get undefined references if you put it before the ...
The LIBS is also needed on Cygwin, but you get undefined references if you put it before the ...
- Thu May 30, 2013 9:16 am
- Forum: AES Crypt
- Topic: setlocale to allow UTF-8 characters on command line
- Replies: 6
- Views: 13862
setlocale to allow UTF-8 characters on command line
Can I suggest adding:
setlocale(LC_ALL, "");
at the beginning of main() in aescrypt.c etc. to set the locale from the environment.
Without this nl_langinfo(CODESET) always returns ANSI_X3.4-1968 (on both Linux and Cygwin) which then disallows non ASCII characters on the command line in the ...
setlocale(LC_ALL, "");
at the beginning of main() in aescrypt.c etc. to set the locale from the environment.
Without this nl_langinfo(CODESET) always returns ANSI_X3.4-1968 (on both Linux and Cygwin) which then disallows non ASCII characters on the command line in the ...