On Tue, Feb 14, 2023 at 1:45 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> 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 测试-加-增加-加-增加