delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/22/05:07:29

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Sat, 22 Aug 2009 11:06:56 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: KOI8
Message-ID: <20090822090656.GN32408@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <416096c60908201343g6134c93ao3f4646f6e3fc0dfe AT mail DOT gmail DOT com> <20090821074927 DOT GD32408 AT calimero DOT vinschen DOT de> <20090821210536 DOT GM32408 AT calimero DOT vinschen DOT de> <416096c60908220145q1b186194l67c279fd394ec96a AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <416096c60908220145q1b186194l67c279fd394ec96a@mail.gmail.com>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Aug 22 09:45, Andy Koppe wrote:
> Corinna Vinschen:
> >> > Anyway, to help support them, the attached patch adds the KOI8
> >> > charsets to newlib's Unicode conversion and ctype tables. I took the
> >> > conversion tables from iconv and adapted the ctype tables from the
> >> > CP1251 version. Since KOI8 has printable characters in the C1 range
> >> > from 0x80 to 0x9F, it seems easiest to treat them as Windows
> >> > codepages.
> >> >
> >> > To complete support, "KOI8-R" and "KOI8-U" would need to be recognised
> >> > in _setlocale_r and mapped to codepages 20866 and 21866.
> >>
> >> I'd suggest to add the missing code to loadlocale()  (the internally
> >> used charset should be set to "CP20866"/"CP21866", but it seems you know
> >> this already) and send the entire patch, together with a ChangeLog
> >> entry, to the newlib list.  If you could base it on my pending proposal
> >> to make the charset case insensitive
> >> http://sourceware.org/ml/newlib/2009/msg00840.html, that would be great.
> >
> > I applied this patch  a couple of minutes ago, so you can simply base
> > your patch on current CVS.
> 
> Okay, will do.

Thanks!  Here's a (untested) suggestion:

Index: libc/locale/locale.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/locale/locale.c,v
retrieving revision 1.23
diff -u -p -r1.23 locale.c
--- libc/locale/locale.c	21 Aug 2009 20:56:13 -0000	1.23
+++ libc/locale/locale.c	22 Aug 2009 08:59:04 -0000
@@ -615,6 +615,24 @@ loadlocale(struct _reent *p, int categor
 	  return NULL;
 	}
     break;
+    case 'K':
+    case 'k':
+      if (!strcasecmp (charset, "KOI8-R"))
+	strcpy (charset, "CP20866");
+      else if (!strcasecmp (charset, "KOI8-U"))
+	strcpy (charset, "CP21866");
+      else
+        return NULL;
+#ifdef _MB_CAPABLE
+#ifdef _MB_EXTENDED_CHARSETS_WINDOWS
+      l_wctomb = __cp_wctomb;
+      l_mbtowc = __cp_mbtowc;
+#else /* !_MB_EXTENDED_CHARSETS_WINDOWS */
+      l_wctomb = __ascii_wctomb;
+      l_mbtowc = __ascii_mbtowc;
+#endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
+#endif
+      break;
     case 'A':
     case 'a':
       if (strcasecmp (charset, "ASCII"))


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019