From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Y01 Test Failure
Date: Fri, 19 Mar 2021 19:42:38 +0900 [thread overview]
Message-ID: <9F54A3AC-47E4-4238-8C5C-F97F3DD8D7B9@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAHYJk3SB+-hqexEfnTgvJKLU22n1gF_pEmrg=6X2zSDGswYzBQ@mail.gmail.com>
> 2021/03/19 17:27, Mikael Magnusson <mikachu@gmail.com> wrote:
>
> Is this happening even with LC_COLLATE=C, or did we not bother setting
> that for this specific test?
LC_ALL is set to en_US.UTF-8 at the start of Y01completion.ztst.
I've been thinking that comparison of all-ASCII strings is the same
in C and UTF-8 locales. But it turned out that strcoll() behaves quite
*strangely* under en_US.UTf-8 on Linux.
If I run the following C-code:
#include <stdio.h>
#include <string.h>
#include <locale.h>
int main() {
char* s[] = { "h", "i", "j" };
setlocale(LC_COLLATE, "");
for(int i=0; i<3; ++i) {
printf("'%s' - '<INSERT>' = %d\n", s[i], strcoll(s[i], "<INSERT>"));
}
return 0;
}
% export LC_COLLATE=C
% ./a.out
'h' - '<INSERT>' = 44
'i' - '<INSERT>' = 45
'j' - '<INSERT>' = 46
% export LC_COLLATE=en_US.UTF-8
% ./a.out
'h' - '<INSERT>' = -11
'i' - '<INSERT>' = -1
'j' - '<INSERT>' = 1
% export LC_COLLATE=ja_JP.UTF-8
% ./a.out
'h' - '<INSERT>' = 44
'i' - '<INSERT>' = 45
'j' - '<INSERT>' = 46
I can't understand the behavior under en_US.UTF-8 locale.
next prev parent reply other threads:[~2021-03-19 10:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 15:20 Vin Shelton
2021-03-18 15:48 ` Bart Schaefer
2021-03-18 15:54 ` Bart Schaefer
2021-03-19 6:00 ` Jun T
2021-03-19 8:27 ` Mikael Magnusson
2021-03-19 10:42 ` Jun T [this message]
2021-03-22 2:09 ` dana
2021-03-22 11:06 ` Vin Shelton
2021-03-28 5:25 ` dana
2021-11-12 19:23 Y02 test failure Marlon Richert
2021-11-12 19:56 ` Bart Schaefer
2021-11-12 21:28 ` Marlon Richert
2021-11-12 21:49 ` Bart Schaefer
2021-11-12 22:00 ` Lawrence Velázquez
2021-11-13 17:15 ` Marlon Richert
2021-11-29 21:43 ` Y01 " Marlon Richert
2021-11-30 14:57 ` Jun. T
2021-12-01 3:39 ` Bart Schaefer
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=9F54A3AC-47E4-4238-8C5C-F97F3DD8D7B9@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).