comparison tests/test-commit-interactive.t @ 29154:9d38a2061fd8 stable

patch: show lower-ed translated message correctly Before this patch, patch.filterpatch() shows meaningless translation of help message for chunk selection in some encoding. It applies str.lower() instead of encoding.lower(str) on translated message, but some encoding uses 0x41(A) - 0x5a(Z) as the second or later byte of multi-byte character (for example, ja_JP.cp932), and str.lower() causes unexpected result. To show lower-ed translated message correctly, this patch replaces str.lower() by encoding.lower(str).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 13 May 2016 07:19:59 +0900
parents ad2cd2ef25d9
children 8c5e880c7e25
comparison
equal deleted inserted replaced
29094:1111e84de635 29154:9d38a2061fd8
876 examine changes to 'subdir/f1'? [Ynesfdaq?] q 876 examine changes to 'subdir/f1'? [Ynesfdaq?] q
877 877
878 abort: user quit 878 abort: user quit
879 [255] 879 [255]
880 880
881 #if gettext
882
883 Test translated help message
884
885 str.lower() instead of encoding.lower(str) on translated message might
886 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
887 as the second or later byte of multi-byte character.
888
889 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
890 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
891 replacement makes message meaningless.
892
893 This tests that translated help message is lower()-ed correctly.
894
895 $ LANGUAGE=ja
896 $ export LANGUAGE
897
898 $ hg commit -i --encoding cp932 2>&1 <<EOF | grep '^y - '
899 > ?
900 > q
901 > EOF
902 y - \x82\xb1\x82\xcc\x95\xcf\x8dX\x82\xf0\x8bL\x98^(yes) (esc)
903
904 $ LANGUAGE=
905 #endif
906
881 Skip 907 Skip
882 908
883 $ hg commit -i <<EOF 909 $ hg commit -i <<EOF
884 > s 910 > s
885 > EOF 911 > EOF