mirror of
https://github.com/0intro/wmii
synced 2025-02-09 10:54:57 +03:00
Use nl_langinfo(3) instead of the unportable "" to specify the default character set for iconv_open(3). Thanks to Alex Plotnick for the patch.
This commit is contained in:
parent
7e50917ae3
commit
e44c0627aa
@ -2,6 +2,7 @@
|
||||
#include "dat.h"
|
||||
#include <errno.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
#include <string.h>
|
||||
#include "fns.h"
|
||||
|
||||
@ -11,8 +12,11 @@ toutf8n(char *str, size_t nstr) {
|
||||
char *buf, *pos;
|
||||
size_t nbuf, bsize;
|
||||
|
||||
if(cd == nil)
|
||||
cd = iconv_open("UTF-8", "");
|
||||
if(cd == nil) {
|
||||
cd = iconv_open("UTF-8", nl_langinfo(CODESET));
|
||||
if(cd == (iconv_t)-1)
|
||||
fatal("Can't convert from native codeset to UTF-8");
|
||||
}
|
||||
iconv(cd, nil, nil, nil, nil);
|
||||
|
||||
bsize = nstr * 1.25 + 4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user