From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10991 Path: news.gmane.org!.POSTED!not-for-mail From: He X Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8' Date: Mon, 30 Jan 2017 22:17:37 +0800 Message-ID: References: <20170129133946.GT17692@port70.net> <20170129140747.GJ1533@brightrain.aerifal.cx> <20170129163714.GM1533@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c14c268759c5e0547507b7d X-Trace: blaine.gmane.org 1485785895 32560 195.159.176.226 (30 Jan 2017 14:18:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2017 14:18:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11006-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 30 15:18:07 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cYCmV-0008Ba-8m for gllmg-musl@m.gmane.org; Mon, 30 Jan 2017 15:18:07 +0100 Original-Received: (qmail 20076 invoked by uid 550); 30 Jan 2017 14:18:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 20047 invoked from network); 30 Jan 2017 14:18:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=v2bs2x+tqp2TQT8YFrDh2tNm3fs72of0cs0+NbHyX7U=; b=fgtPcPgqvBe63/u/yWOTV/9wZNoxVEfol2A3ZIL0xClTdQ5T/GI+mEglgV63GQ+qwu FycJoyWN/OVMkvBFaZ4DqYdwq2v9rdsTCdxgoQcjT+zGpNbWnk+/x+zpDemLTsxWt1Vw diU9S9gLqfRHFd8dUeSDX6N1Y+Cgg8Gwb44a0UTlSgW93mo2nCpAtiQ5R7+zB8o1CH2g e7bsCqfy6Uy9NP3oTcChLhKV3M+JiX4dTNNCYmsscMZhdZXk06nTUszvYRZ3BpjKMy53 xs52BdIXlEWEGAXwLFDdiSfZHZTWeOSdhmUaTe6miYt1AiQdFed0gBy/OP+yTIsADhcI Edgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=v2bs2x+tqp2TQT8YFrDh2tNm3fs72of0cs0+NbHyX7U=; b=lFTU8us+ItLmqsYj3HJh2F7pPUqwsJxUfa4NewveFRpYAtRqCp8Ts0w+VM7LwiyIwg CGR5Q9D2qIu6wGn3CoCXNJLhHm4SkhpH0Zf5BNuW6VQsOspoajbh5wrTIQ+bLBt34Nw5 KA06ubqf1+lolvRJdE+MNS9KB5umX8DWoHqmXCujSVEro52LKcOqQyjGIMTvnqYrK0jV 58ipEGT30H/jaHeQGm1sHomSyKvisAYLv3CFWBN7ZgK27SIIjF0NCo7ni+hNaGtaiXE4 +hNS6UBRgGN6gp5TLKa1oP/tiECZ5LE0gVw+rVHyBe9rS/JrFLuMzrwkwLI9AainnBn1 WpNA== X-Gm-Message-State: AIkVDXIAqEB0PfiSoYo3+hITHIwudSPml3t6RZpsZJiV4YctUh9xU5woec6gKddYbjTgG20YbR3O+DpnI+C/Xg== X-Received: by 10.31.242.11 with SMTP id q11mr10729810vkh.54.1485785877810; Mon, 30 Jan 2017 06:17:57 -0800 (PST) In-Reply-To: <20170129163714.GM1533@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:10991 Archived-At: --94eb2c14c268759c5e0547507b7d Content-Type: text/plain; charset=UTF-8 1. how do we validate if a name is correct? i mean how do we attempt with zh, zh_CN, zh_CN@xx? using open() to check? what's the fastest and correctest way? 2. Thx for your help, nsz! 2017-01-30 0:37 GMT+08:00 Rich Felker : > On Sun, Jan 29, 2017 at 10:48:34PM +0800, He X wrote: > > btw, with 'p-> to q->', 'strip .UTF-8'(these two in the first thread), > and > > these two patches, fcitx, chromium are working well. > > Can I ask how .UTF-8 got in the locale name to begin with? Did you put > it there, or was it copied from another non-glibc system you logged in > from, or did chromium itself add it? > > Re: the original patch, it should probably (depending on what we want > to do with other invalid encodings) either use strchr to find the > first '.' and strip everything after it, or something like: > > if (loclen > 6 && !strcmp(locname+loclen-6, ".UTF-8")) > > There's no reason to pull strstr in here. > > Rich > --94eb2c14c268759c5e0547507b7d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
1. how do we validate if a name is correct? i mean how do = we attempt with zh, zh_CN, zh_CN@xx? using open() to check? what's the = fastest and correctest way?
2. Thx for your help, nsz!=C2=A0

2017-01-30 0:37 = GMT+08:00 Rich Felker <dalias@libc.org>:
On Sun, Jan 29, 2017 at 10:48:34PM +0800, He= X wrote:
> btw, with 'p-> to q->', 'str= ip .UTF-8'(these two in the first thread),=C2=A0 and
> these two patches, fcitx, chromium are working well.

Can I ask how .UTF-8 got in the locale name to begin with? Did you p= ut
it there, or was it copied from another non-glibc system you logged in
from, or did chromium itself add it?

Re: the original patch, it should probably (depending on what we want
to do with other invalid encodings) either use strchr to find the
first '.' and strip everything after it, or something like:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (loclen > 6 && !strcmp(locname+lo= clen-6, ".UTF-8"))

There's no reason to pull strstr in here.

Rich

--94eb2c14c268759c5e0547507b7d--