Re: bug report: symbolic-ref --short command echos the wrong text while use Chinese language
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 14, 2023, 06:55 UTC
- Message-ID
- <CAPig+cQLRDJY_9zjEu2DdZug8h9QNSUVCzDC7W65Cm=eQ-3MiQ@mail.gmail.com>
- In-Reply-To
- <xmqq3578924s.fsf@gitster.g>
On Tue, Feb 14, 2023 at 1:45 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > > Using (presumably) valid LANG codes results in the buggy truncated > > output, but "LANG=C" produces the correct result: > > > > $ for i in C en_US fr_FR de_DE ru_RU zh_CN; do printf "$i: " && > > LANG=$i.UTF-8 git symbolic-ref --short HEAD; done > > C: 测试-加-增加-加-增加 > > en_US: 测试-? > > fr_FR: 测试-? > > de_DE: 测试-? > > ru_RU: 测试-? > > zh_CN: 测试-? > > So the system cares more than just "is this a valid UTF-8 sequence?" > but somehow knows that the given sequence is a valid Chinese and not > valid English? ---oh, no, zh_CN is rejected, but your earlier zh-CN > somehow was accepted? > > Now, it is beyond my ability to guess what macOS is internally doing > wrong X-<.
I don't think the earlier incorrect "zh-CN" (in which I used "-" rather than "_") was accepted. Rather, the system simply didn't recognize it, thus presumably fell back to "C" locale. The same "correct" output results from any bogus LANG value:
$ LANG=bogus git symbolic-ref --short HEAD 测试-加-增加-加-增加