This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/cygwin]: Return correct charset in nl_langinfo


On Oct  7 18:45, Corinna Vinschen wrote:
> Hi,
> 
> I just applied the below patch, which only affects Cygwin.  [...]
> 	* libc/locale/nl_langinfo.c (nl_langinfo): Just return current locale
> 	charset on Cygwin.

Unfortunately it's quite important that the KOI8 charsets return a
matching string from nl_langinfo.  I added a special case for them
for now and applied the below, still Cygwin-only patch.


Corinna


	* libc/locale/nl_langinfo.c (nl_langinfo): Add Cygwin-specific temporary
	exception for KOI8 charsets.


Index: libc/locale/nl_langinfo.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/locale/nl_langinfo.c,v
retrieving revision 1.3
diff -u -p -r1.3 nl_langinfo.c
--- libc/locale/nl_langinfo.c	7 Oct 2009 16:45:23 -0000	1.3
+++ libc/locale/nl_langinfo.c	15 Oct 2009 08:07:13 -0000
@@ -60,6 +60,12 @@ _DEFUN(nl_langinfo, (item), 
 	case CODESET:
 #ifdef __CYGWIN__
 		ret = __locale_charset ();
+		/* Temporary exception for KOI8 charsets which are
+		   incorrectly treated by calling applications otherwise. */
+		if (strcmp (ret, "CP20866") == 0)
+		  ret = "KOI8-R";
+		else if (strcmp (ret, "CP21866") == 0)
+		  ret = "KOI8-U";
 #else
 		ret = "";
 		if ((s = setlocale(LC_CTYPE, NULL)) != NULL) {


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]