Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 3 Mar 2020 15:45:00 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] Decode 0x80 Euro for GBK

On Tue, Mar 03, 2020 at 04:09:54PM +0800, Mingye Wang wrote:
> Hi,
> 
> Sorry for the inconvenience, but please check the attachment.
> --
> Mingye Wang (Artoria2e5)

> From 0451fe959a55cf19d17ca131d68825922e1357a4 Mon Sep 17 00:00:00 2001
> From: Mingye Wang <arthur200126@...il.com>
> Date: Tue, 3 Mar 2020 15:56:15 +0800
> Subject: [PATCH] Decode 0x80 Euro for GBK
> 
> Microsoft's cp936 has a Euro sign in its complete form, and it is the
> official IANA "GBK". Add it.
> 
> Ref: https://encoding.spec.whatwg.org/#gbk-flag
> Ref: https://www.iana.org/assignments/charset-reg/GBK
> ---
>  src/locale/iconv.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/locale/iconv.c b/src/locale/iconv.c
> index 3047c27b..d01342a2 100644
> --- a/src/locale/iconv.c
> +++ b/src/locale/iconv.c
> @@ -403,6 +403,11 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
>  			if (c < 128) break;
>  			if (c < 0xa1) goto ilseq;
>  		case GBK:
> +			// CP936 Euro. WHATWG tolerates it in GB18030, should we too?
> +			if (c == 128) {
> +				c = 0x20AC;
> +				break;
> +			}
>  		case GB18030:
>  			if (c < 128) break;
>  			c -= 0x81;

Does this mean GBK encodes the euro sign twice? Or is the normal
encoding of it only present in GB18030, not legacy GBK?

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.