From c2f1df1d4af0c7e633528cb4c8caa79ef04b0b5a Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 10 Mar 2016 18:17:39 -0800 Subject: 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. --- src/fallback.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/fallback.h') diff --git a/src/fallback.h b/src/fallback.h index e3044449..f3252c14 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -158,29 +158,13 @@ int vswprintf(wchar_t *out, size_t n, const wchar_t *filter, va_list va); #endif #ifndef HAVE_FGETWC -/** - Fallback implementation of fgetwc -*/ +// Fallback implementation of fgetwc. wint_t fgetwc(FILE *stream); - -/** - Fallback implementation of getwc -*/ -wint_t getwc(FILE *stream); - #endif #ifndef HAVE_FPUTWC - -/** - Fallback implementation of fputwc -*/ +// Fallback implementation of fputwc. wint_t fputwc(wchar_t wc, FILE *stream); -/** - Fallback implementation of putwc -*/ -wint_t putwc(wchar_t wc, FILE *stream); - #endif #ifndef HAVE_WCSTOK -- cgit v1.2.3