diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-03-10 18:17:39 -0800 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-03-20 18:47:38 -0700 |
commit | c2f1df1d4af0c7e633528cb4c8caa79ef04b0b5a (patch) | |
tree | 0776e975779488cb842c09a5d79d193cb7cf9fdc /src/wutil.h | |
parent | fb0921249f4584e68699e336be249a655b9c8ede (diff) |
fix handling of non-ASCII chars in C locale
The relevant standards allow the mbtowc/mbrtowc functions to reject
non-ASCII characters (i.e., chars with the high bit set) when the locale
is C or POSIX. The BSD libraries (e.g., on OS X) don't do this but
the GNU libraries (e.g., on Linux) do. Like most programs we need the
C/POSIX locales to allow arbitrary bytes. So explicitly check if we're
in a single-byte locale (which would also include ISO-8859 variants)
and simply pass-thru the chars without encoding or decoding.
Fixes #2802.
Diffstat (limited to 'src/wutil.h')
-rw-r--r-- | src/wutil.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/wutil.h b/src/wutil.h index 9897439a..a14dfa9b 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -70,10 +70,8 @@ void safe_perror(const char *message); */ const char *safe_strerror(int err); -/** - Wide character version of getcwd(). -*/ -wchar_t *wgetcwd(wchar_t *buff, size_t sz); +// Wide character version of getcwd(). +const wcstring wgetcwd(); /** Wide character version of chdir() |