public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] drop ambiguous-wide behaviour from Unicode CJK locales
Date: Tue, 13 Oct 2020 12:04:26 +0000 (GMT)	[thread overview]
Message-ID: <20201013120426.A5C9B385780B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1ed2fe0f03f4c8f9cb663c36720e786a229bcabe

commit 1ed2fe0f03f4c8f9cb663c36720e786a229bcabe
Author: Thomas Wolff <towo@towo.net>
Date:   Wed Oct 7 18:35:54 2020 +0200

    drop ambiguous-wide behaviour from Unicode CJK locales

Diff:
---
 newlib/libc/locale/locale.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index 2c452ba98..968642745 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -78,12 +78,9 @@ This implementation also supports the modifiers <<"cjknarrow">> and
 <<"cjkwide">>, which affect how the functions <<wcwidth>> and <<wcswidth>>
 handle characters from the "CJK Ambiguous Width" category of characters
 described at http://www.unicode.org/reports/tr11/#Ambiguous.
-These characters have a width of 1 for singlebyte charsets and a width of 2
-for multibyte charsets other than UTF-8.
-For UTF-8, their width depends on the language specifier:
-it is 2 for <<"zh">> (Chinese), <<"ja">> (Japanese), and <<"ko">> (Korean),
-and 1 for everything else. Specifying <<"cjknarrow">> or <<"cjkwide">>
-forces a width of 1 or 2, respectively, independent of charset and language.
+These characters have a width of 1 for singlebyte charsets and UTF-8,
+and a width of 2 for multibyte charsets other than UTF-8. Specifying
+<<"cjknarrow">> or <<"cjkwide">> forces a width of 1 or 2, respectively.
 
 This implementation also supports the modifier <<"cjksingle">>
 to enforce single-width character properties.
@@ -903,17 +900,12 @@ restart:
       /* Determine the width for the "CJK Ambiguous Width" category of
          characters. This is used in wcwidth(). Assume single width for
          single-byte charsets, and double width for multi-byte charsets
-         other than UTF-8. For UTF-8, use double width for the East Asian
-         languages ("ja", "ko", "zh"), and single width for everything else.
+         other than UTF-8. For UTF-8, use single width.
          Single width can also be forced with the "@cjknarrow" modifier.
          Double width can also be forced with the "@cjkwide" modifier.
        */
       loc->cjk_lang = cjkwide ||
-		      (!cjknarrow && mbc_max > 1
-		       && (charset[0] != 'U'
-			   || strncmp (locale, "ja", 2) == 0
-			   || strncmp (locale, "ko", 2) == 0
-			   || strncmp (locale, "zh", 2) == 0));
+		      (!cjknarrow && mbc_max > 1 && charset[0] != 'U');
       if (cjksingle)
 	loc->cjk_lang = -1;	/* Disable CJK dual-width */
 #ifdef __HAVE_LOCALE_INFO__


                 reply	other threads:[~2020-10-13 12:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201013120426.A5C9B385780B@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).