1234567891011121314151617181920212223242526272829303132333435363738394041 |
- $OpenBSD: patch-libraries_base_cbits_PrelIOUtils_c,v 1.3 2015/09/19 07:42:57 kili Exp $
- We have very limited locale support so used latin1 as default codeset
- which can be overridden by the environment variable `HS_ENCODING'.
- --- libraries/base/cbits/PrelIOUtils.c.orig Tue Dec 23 03:31:10 2014
- +++ libraries/base/cbits/PrelIOUtils.c Sun Aug 9 17:35:52 2015
- @@ -19,27 +19,13 @@ void debugBelch2(const char*s, char *t)
- debugBelch(s,t);
- }
-
- -#if defined(HAVE_LIBCHARSET)
- -# include <libcharset.h>
- -#elif defined(HAVE_LANGINFO_H)
- -# include <langinfo.h>
- -#endif
- -
- #if !defined(mingw32_HOST_OS)
- +#include <stdlib.h>
- +#include <string.h>
- const char* localeEncoding(void)
- {
- -#if defined(HAVE_LIBCHARSET)
- - return locale_charset();
- -
- -#elif defined(HAVE_LANGINFO_H)
- - return nl_langinfo(CODESET);
- -
- -#else
- -#warning Depending on the unportable behavior of GNU iconv due to absence of both libcharset and langinfo.h
- - /* GNU iconv accepts "" to mean the current locale's
- - * encoding. Warning: This isn't portable.
- - */
- - return "";
- -#endif
- + char *l;
- + l = getenv("HS_ENCODING");
- + return l != NULL ? l : "latin1";
- }
- #endif
|