NetBSD Problem Report #57339
From www@netbsd.org Sun Apr 9 21:22:40 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 36E7B1A9239
for <gnats-bugs@gnats.NetBSD.org>; Sun, 9 Apr 2023 21:22:40 +0000 (UTC)
Message-Id: <20230409212238.E03061A923A@mollari.NetBSD.org>
Date: Sun, 9 Apr 2023 21:22:38 +0000 (UTC)
From: bruno@clisp.org
Reply-To: bruno@clisp.org
To: gnats-bugs@NetBSD.org
Subject: towupper and towlower malfunction in zh_CN.GB18030 locale
X-Send-Pr-Version: www-1.0
>Number: 57339
>Category: lib
>Synopsis: towupper and towlower malfunction in zh_CN.GB18030 locale
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 09 21:25:00 +0000 2023
>Originator: Bruno Haible
>Release: 9.0
>Organization:
GNU
>Environment:
NetBSD 9.0 amd64
>Description:
In the zh_CN.GB18030 locale, the towupper and towupper functions map the ASCII letters (A..Z, a..z) in a nonsensical way.
>How-To-Repeat:
Compile and run this program:
=============================================================
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
/* towlower and towupper are botched in the zh_CN.GB18030 locale. */
int main ()
{
if (setlocale (LC_ALL, "zh_CN.GB18030") == NULL)
return 1;
int result = 0;
wchar_t ua = btowc ('A');
wchar_t la = btowc ('a');
if (towupper (ua) != ua) {
printf ("towupper (%lc) -> %lc\n", ua, towupper (ua));
result |= 2;
}
if (towupper (la) != ua) {
printf ("towupper (%lc) -> %lc\n", la, towupper (la));
result |= 4;
}
if (towlower (ua) != la) {
printf ("towlower (%lc) -> %lc\n", ua, towlower (ua));
result |= 8;
}
if (towlower (la) != la) {
printf ("towlower (%lc) -> %lc\n", la, towlower (la));
result |= 16;
}
return result;
}
=============================================================
Expected result: no output.
Actual result:
towupper (A) -> a
towupper (a) -> a
towlower (A) -> A
towlower (a) -> A
>Fix:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.