From d3f0b39eef72b61b73721ebc42795306468931ce Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sun, 12 Jun 2011 21:40:36 +0900 Subject: [PATCH] If codeset is not set by the user, use a codepage for a codeset on OS/2 --- libcharset/lib/localcharset.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/libcharset/lib/localcharset.c b/libcharset/lib/localcharset.c index 3aceb42..1de9e4b 100644 --- a/libcharset/lib/localcharset.c +++ b/libcharset/lib/localcharset.c @@ -474,6 +474,8 @@ locale_charset (void) static char buf[2 + 10 + 1]; ULONG cp[3]; ULONG cplen; + int use_cp = 0; + int from_lang = 0; /* Allow user to override the codeset, as set in the operating system, with standard language environment variables. */ @@ -482,7 +484,10 @@ locale_charset (void) { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') - locale = getenv ("LANG"); + { + locale = getenv ("LANG"); + from_lang = 1; + } } if (locale != NULL && locale[0] != '\0') { @@ -505,11 +510,16 @@ locale_charset (void) return buf; } } + else + use_cp = from_lang; /* Resolve through the charset.alias file. */ codeset = locale; } else + use_cp = 1; + + if (use_cp) { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) -- 1.7.3.2