@matheusbsbs / matheus-bagliano / commits / fd8ccbec4f
Fork 0

gitk: Work around Tcl's non-standard names for encodings

This uses a table of encoding names and aliases distilled from http://www.iana.org/assignments/character-sets plus some heuristics to convert standard encoding names to ones that Tcl recognizes. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Dec 7, 2005 at 23:28 UTC fd8ccbec4f0161b14f804a454e68b29e24840ad3
1 file changed +374 -94
gitk
+374 -94
@@ -34,7 +34,7 @@ proc parse_args {rargs} {
34
35 proc start_rev_list {rlargs} {
36 global startmsecs nextupdate ncmupdate
37 - global commfd leftover gitencoding
37 + global commfd leftover tclencoding
38
39 set startmsecs [clock clicks -milliseconds]
40 set nextupdate [expr {$startmsecs + 100}]
@@ -47,7 +47,10 @@ proc start_rev_list {rlargs} {
47 exit 1
48 }
49 set leftover {}
50 - fconfigure $commfd -blocking 0 -translation lf -encoding $gitencoding
50 + fconfigure $commfd -blocking 0 -translation lf
51 + if {$tclencoding != {}} {
52 + fconfigure $commfd -encoding $tclencoding
53 + }
54 fileevent $commfd readable [list getcommitlines $commfd]
55 . config -cursor watch
56 settextcursor watch
@@ -182,6 +185,96 @@ proc readcommit {id} {
185 parsecommit $id $contents 0 {}
186 }
187
188 +proc updatecommits {rargs} {
189 + global commitlisted commfd phase
190 + global startmsecs nextupdate ncmupdate
191 + global idtags idheads idotherrefs
192 + global leftover
193 + global parsed_args
194 + global canv mainfont
195 + global oldcommits commits
196 + global parents nchildren children ncleft
197 +
198 + set old_args $parsed_args
199 + parse_args $rargs
200 +
201 + if {$phase == "getcommits" || $phase == "incrdraw"} {
202 + # havent read all the old commits, just start again from scratch
203 + stopfindproc
204 + set oldcommits {}
205 + set commits {}
206 + foreach v {children nchildren parents commitlisted commitinfo
207 + selectedline matchinglines treediffs
208 + mergefilelist currentid rowtextx} {
209 + global $v
210 + catch {unset $v}
211 + }
212 + readrefs
213 + if {$phase == "incrdraw"} {
214 + allcanvs delete all
215 + $canv create text 3 3 -anchor nw -text "Reading commits..." \
216 + -font $mainfont -tags textitems
217 + set phase getcommits
218 + }
219 + start_rev_list $parsed_args
220 + return
221 + }
222 +
223 + foreach id $old_args {
224 + if {![regexp {^[0-9a-f]{40}$} $id]} continue
225 + if {[info exists oldref($id)]} continue
226 + set oldref($id) $id
227 + lappend ignoreold "^$id"
228 + }
229 + foreach id $parsed_args {
230 + if {![regexp {^[0-9a-f]{40}$} $id]} continue
231 + if {[info exists ref($id)]} continue
232 + set ref($id) $id
233 + lappend ignorenew "^$id"
234 + }
235 +
236 + foreach a $old_args {
237 + if {![info exists ref($a)]} {
238 + lappend ignorenew $a
239 + }
240 + }
241 +
242 + set phase updatecommits
243 + set oldcommits $commits
244 + set commits {}
245 + set removed_commits [split [eval exec git-rev-list $ignorenew] "\n" ]
246 + if {[llength $removed_commits] > 0} {
247 + allcanvs delete all
248 + foreach c $removed_commits {
249 + set i [lsearch -exact $oldcommits $c]
250 + if {$i >= 0} {
251 + set oldcommits [lreplace $oldcommits $i $i]
252 + unset commitlisted($c)
253 + foreach p $parents($c) {
254 + if {[info exists nchildren($p)]} {
255 + set j [lsearch -exact $children($p) $c]
256 + if {$j >= 0} {
257 + set children($p) [lreplace $children($p) $j $j]
258 + incr nchildren($p) -1
259 + }
260 + }
261 + }
262 + }
263 + }
264 + set phase removecommits
265 + }
266 +
267 + set args {}
268 + foreach a $parsed_args {
269 + if {![info exists oldref($a)]} {
270 + lappend args $a
271 + }
272 + }
273 +
274 + readrefs
275 + start_rev_list [concat $ignoreold $args]
276 +}
277 +
278 proc updatechildren {id olds} {
279 global children nchildren parents nparents ncleft
280
@@ -3624,96 +3717,6 @@ proc rereadrefs {} {
3717 }
3718 }
3719
3627 -proc updatecommits {rargs} {
3628 - global commitlisted commfd phase
3629 - global startmsecs nextupdate ncmupdate
3630 - global idtags idheads idotherrefs
3631 - global leftover
3632 - global parsed_args
3633 - global canv mainfont
3634 - global oldcommits commits
3635 - global parents nchildren children ncleft
3636 -
3637 - set old_args $parsed_args
3638 - parse_args $rargs
3639 -
3640 - if {$phase == "getcommits" || $phase == "incrdraw"} {
3641 - # havent read all the old commits, just start again from scratch
3642 - stopfindproc
3643 - set oldcommits {}
3644 - set commits {}
3645 - foreach v {children nchildren parents commitlisted commitinfo
3646 - selectedline matchinglines treediffs
3647 - mergefilelist currentid rowtextx} {
3648 - global $v
3649 - catch {unset $v}
3650 - }
3651 - readrefs
3652 - if {$phase == "incrdraw"} {
3653 - allcanvs delete all
3654 - $canv create text 3 3 -anchor nw -text "Reading commits..." \
3655 - -font $mainfont -tags textitems
3656 - set phase getcommits
3657 - }
3658 - start_rev_list $parsed_args
3659 - return
3660 - }
3661 -
3662 - foreach id $old_args {
3663 - if {![regexp {^[0-9a-f]{40}$} $id]} continue
3664 - if {[info exists oldref($id)]} continue
3665 - set oldref($id) $id
3666 - lappend ignoreold "^$id"
3667 - }
3668 - foreach id $parsed_args {
3669 - if {![regexp {^[0-9a-f]{40}$} $id]} continue
3670 - if {[info exists ref($id)]} continue
3671 - set ref($id) $id
3672 - lappend ignorenew "^$id"
3673 - }
3674 -
3675 - foreach a $old_args {
3676 - if {![info exists ref($a)]} {
3677 - lappend ignorenew $a
3678 - }
3679 - }
3680 -
3681 - set phase updatecommits
3682 - set oldcommits $commits
3683 - set commits {}
3684 - set removed_commits [split [eval exec git-rev-list $ignorenew] "\n" ]
3685 - if {[llength $removed_commits] > 0} {
3686 - allcanvs delete all
3687 - foreach c $removed_commits {
3688 - set i [lsearch -exact $oldcommits $c]
3689 - if {$i >= 0} {
3690 - set oldcommits [lreplace $oldcommits $i $i]
3691 - unset commitlisted($c)
3692 - foreach p $parents($c) {
3693 - if {[info exists nchildren($p)]} {
3694 - set j [lsearch -exact $children($p) $c]
3695 - if {$j >= 0} {
3696 - set children($p) [lreplace $children($p) $j $j]
3697 - incr nchildren($p) -1
3698 - }
3699 - }
3700 - }
3701 - }
3702 - }
3703 - set phase removecommits
3704 - }
3705 -
3706 - set args {}
3707 - foreach a $parsed_args {
3708 - if {![info exists oldref($a)]} {
3709 - lappend args $a
3710 - }
3711 - }
3712 -
3713 - readrefs
3714 - start_rev_list [concat $ignoreold $args]
3715 -}
3716 -
3720 proc showtag {tag isnew} {
3721 global ctext cflist tagcontents tagids linknum
3722
@@ -3811,17 +3814,294 @@ proc formatdate {d} {
3814 return [clock format $d -format "%Y-%m-%d %H:%M:%S"]
3815 }
3816
3817 +# This list of encoding names and aliases is distilled from
3818 +# http://www.iana.org/assignments/character-sets.
3819 +# Not all of them are supported by Tcl.
3820 +set encoding_aliases {
3821 + { ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
3822 + ISO646-US US-ASCII us IBM367 cp367 csASCII }
3823 + { ISO-10646-UTF-1 csISO10646UTF1 }
3824 + { ISO_646.basic:1983 ref csISO646basic1983 }
3825 + { INVARIANT csINVARIANT }
3826 + { ISO_646.irv:1983 iso-ir-2 irv csISO2IntlRefVersion }
3827 + { BS_4730 iso-ir-4 ISO646-GB gb uk csISO4UnitedKingdom }
3828 + { NATS-SEFI iso-ir-8-1 csNATSSEFI }
3829 + { NATS-SEFI-ADD iso-ir-8-2 csNATSSEFIADD }
3830 + { NATS-DANO iso-ir-9-1 csNATSDANO }
3831 + { NATS-DANO-ADD iso-ir-9-2 csNATSDANOADD }
3832 + { SEN_850200_B iso-ir-10 FI ISO646-FI ISO646-SE se csISO10Swedish }
3833 + { SEN_850200_C iso-ir-11 ISO646-SE2 se2 csISO11SwedishForNames }
3834 + { KS_C_5601-1987 iso-ir-149 KS_C_5601-1989 KSC_5601 korean csKSC56011987 }
3835 + { ISO-2022-KR csISO2022KR }
3836 + { EUC-KR csEUCKR }
3837 + { ISO-2022-JP csISO2022JP }
3838 + { ISO-2022-JP-2 csISO2022JP2 }
3839 + { JIS_C6220-1969-jp JIS_C6220-1969 iso-ir-13 katakana x0201-7
3840 + csISO13JISC6220jp }
3841 + { JIS_C6220-1969-ro iso-ir-14 jp ISO646-JP csISO14JISC6220ro }
3842 + { IT iso-ir-15 ISO646-IT csISO15Italian }
3843 + { PT iso-ir-16 ISO646-PT csISO16Portuguese }
3844 + { ES iso-ir-17 ISO646-ES csISO17Spanish }
3845 + { greek7-old iso-ir-18 csISO18Greek7Old }
3846 + { latin-greek iso-ir-19 csISO19LatinGreek }
3847 + { DIN_66003 iso-ir-21 de ISO646-DE csISO21German }
3848 + { NF_Z_62-010_(1973) iso-ir-25 ISO646-FR1 csISO25French }
3849 + { Latin-greek-1 iso-ir-27 csISO27LatinGreek1 }
3850 + { ISO_5427 iso-ir-37 csISO5427Cyrillic }
3851 + { JIS_C6226-1978 iso-ir-42 csISO42JISC62261978 }
3852 + { BS_viewdata iso-ir-47 csISO47BSViewdata }
3853 + { INIS iso-ir-49 csISO49INIS }
3854 + { INIS-8 iso-ir-50 csISO50INIS8 }
3855 + { INIS-cyrillic iso-ir-51 csISO51INISCyrillic }
3856 + { ISO_5427:1981 iso-ir-54 ISO5427Cyrillic1981 }
3857 + { ISO_5428:1980 iso-ir-55 csISO5428Greek }
3858 + { GB_1988-80 iso-ir-57 cn ISO646-CN csISO57GB1988 }
3859 + { GB_2312-80 iso-ir-58 chinese csISO58GB231280 }
3860 + { NS_4551-1 iso-ir-60 ISO646-NO no csISO60DanishNorwegian
3861 + csISO60Norwegian1 }
3862 + { NS_4551-2 ISO646-NO2 iso-ir-61 no2 csISO61Norwegian2 }
3863 + { NF_Z_62-010 iso-ir-69 ISO646-FR fr csISO69French }
3864 + { videotex-suppl iso-ir-70 csISO70VideotexSupp1 }
3865 + { PT2 iso-ir-84 ISO646-PT2 csISO84Portuguese2 }
3866 + { ES2 iso-ir-85 ISO646-ES2 csISO85Spanish2 }
3867 + { MSZ_7795.3 iso-ir-86 ISO646-HU hu csISO86Hungarian }
3868 + { JIS_C6226-1983 iso-ir-87 x0208 JIS_X0208-1983 csISO87JISX0208 }
3869 + { greek7 iso-ir-88 csISO88Greek7 }
3870 + { ASMO_449 ISO_9036 arabic7 iso-ir-89 csISO89ASMO449 }
3871 + { iso-ir-90 csISO90 }
3872 + { JIS_C6229-1984-a iso-ir-91 jp-ocr-a csISO91JISC62291984a }
3873 + { JIS_C6229-1984-b iso-ir-92 ISO646-JP-OCR-B jp-ocr-b
3874 + csISO92JISC62991984b }
3875 + { JIS_C6229-1984-b-add iso-ir-93 jp-ocr-b-add csISO93JIS62291984badd }
3876 + { JIS_C6229-1984-hand iso-ir-94 jp-ocr-hand csISO94JIS62291984hand }
3877 + { JIS_C6229-1984-hand-add iso-ir-95 jp-ocr-hand-add
3878 + csISO95JIS62291984handadd }
3879 + { JIS_C6229-1984-kana iso-ir-96 csISO96JISC62291984kana }
3880 + { ISO_2033-1983 iso-ir-98 e13b csISO2033 }
3881 + { ANSI_X3.110-1983 iso-ir-99 CSA_T500-1983 NAPLPS csISO99NAPLPS }
3882 + { ISO_8859-1:1987 iso-ir-100 ISO_8859-1 ISO-8859-1 latin1 l1 IBM819
3883 + CP819 csISOLatin1 }
3884 + { ISO_8859-2:1987 iso-ir-101 ISO_8859-2 ISO-8859-2 latin2 l2 csISOLatin2 }
3885 + { T.61-7bit iso-ir-102 csISO102T617bit }
3886 + { T.61-8bit T.61 iso-ir-103 csISO103T618bit }
3887 + { ISO_8859-3:1988 iso-ir-109 ISO_8859-3 ISO-8859-3 latin3 l3 csISOLatin3 }
3888 + { ISO_8859-4:1988 iso-ir-110 ISO_8859-4 ISO-8859-4 latin4 l4 csISOLatin4 }
3889 + { ECMA-cyrillic iso-ir-111 KOI8-E csISO111ECMACyrillic }
3890 + { CSA_Z243.4-1985-1 iso-ir-121 ISO646-CA csa7-1 ca csISO121Canadian1 }
3891 + { CSA_Z243.4-1985-2 iso-ir-122 ISO646-CA2 csa7-2 csISO122Canadian2 }
3892 + { CSA_Z243.4-1985-gr iso-ir-123 csISO123CSAZ24341985gr }
3893 + { ISO_8859-6:1987 iso-ir-127 ISO_8859-6 ISO-8859-6 ECMA-114 ASMO-708
3894 + arabic csISOLatinArabic }
3895 + { ISO_8859-6-E csISO88596E ISO-8859-6-E }
3896 + { ISO_8859-6-I csISO88596I ISO-8859-6-I }
3897 + { ISO_8859-7:1987 iso-ir-126 ISO_8859-7 ISO-8859-7 ELOT_928 ECMA-118
3898 + greek greek8 csISOLatinGreek }
3899 + { T.101-G2 iso-ir-128 csISO128T101G2 }
3900 + { ISO_8859-8:1988 iso-ir-138 ISO_8859-8 ISO-8859-8 hebrew
3901 + csISOLatinHebrew }
3902 + { ISO_8859-8-E csISO88598E ISO-8859-8-E }
3903 + { ISO_8859-8-I csISO88598I ISO-8859-8-I }
3904 + { CSN_369103 iso-ir-139 csISO139CSN369103 }
3905 + { JUS_I.B1.002 iso-ir-141 ISO646-YU js yu csISO141JUSIB1002 }
3906 + { ISO_6937-2-add iso-ir-142 csISOTextComm }
3907 + { IEC_P27-1 iso-ir-143 csISO143IECP271 }
3908 + { ISO_8859-5:1988 iso-ir-144 ISO_8859-5 ISO-8859-5 cyrillic
3909 + csISOLatinCyrillic }
3910 + { JUS_I.B1.003-serb iso-ir-146 serbian csISO146Serbian }
3911 + { JUS_I.B1.003-mac macedonian iso-ir-147 csISO147Macedonian }
3912 + { ISO_8859-9:1989 iso-ir-148 ISO_8859-9 ISO-8859-9 latin5 l5 csISOLatin5 }
3913 + { greek-ccitt iso-ir-150 csISO150 csISO150GreekCCITT }
3914 + { NC_NC00-10:81 cuba iso-ir-151 ISO646-CU csISO151Cuba }
3915 + { ISO_6937-2-25 iso-ir-152 csISO6937Add }
3916 + { GOST_19768-74 ST_SEV_358-88 iso-ir-153 csISO153GOST1976874 }
3917 + { ISO_8859-supp iso-ir-154 latin1-2-5 csISO8859Supp }
3918 + { ISO_10367-box iso-ir-155 csISO10367Box }
3919 + { ISO-8859-10 iso-ir-157 l6 ISO_8859-10:1992 csISOLatin6 latin6 }
3920 + { latin-lap lap iso-ir-158 csISO158Lap }
3921 + { JIS_X0212-1990 x0212 iso-ir-159 csISO159JISX02121990 }
3922 + { DS_2089 DS2089 ISO646-DK dk csISO646Danish }
3923 + { us-dk csUSDK }
3924 + { dk-us csDKUS }
3925 + { JIS_X0201 X0201 csHalfWidthKatakana }
3926 + { KSC5636 ISO646-KR csKSC5636 }
3927 + { ISO-10646-UCS-2 csUnicode }
3928 + { ISO-10646-UCS-4 csUCS4 }
3929 + { DEC-MCS dec csDECMCS }
3930 + { hp-roman8 roman8 r8 csHPRoman8 }
3931 + { macintosh mac csMacintosh }
3932 + { IBM037 cp037 ebcdic-cp-us ebcdic-cp-ca ebcdic-cp-wt ebcdic-cp-nl
3933 + csIBM037 }
3934 + { IBM038 EBCDIC-INT cp038 csIBM038 }
3935 + { IBM273 CP273 csIBM273 }
3936 + { IBM274 EBCDIC-BE CP274 csIBM274 }
3937 + { IBM275 EBCDIC-BR cp275 csIBM275 }
3938 + { IBM277 EBCDIC-CP-DK EBCDIC-CP-NO csIBM277 }
3939 + { IBM278 CP278 ebcdic-cp-fi ebcdic-cp-se csIBM278 }
3940 + { IBM280 CP280 ebcdic-cp-it csIBM280 }
3941 + { IBM281 EBCDIC-JP-E cp281 csIBM281 }
3942 + { IBM284 CP284 ebcdic-cp-es csIBM284 }
3943 + { IBM285 CP285 ebcdic-cp-gb csIBM285 }
3944 + { IBM290 cp290 EBCDIC-JP-kana csIBM290 }
3945 + { IBM297 cp297 ebcdic-cp-fr csIBM297 }
3946 + { IBM420 cp420 ebcdic-cp-ar1 csIBM420 }
3947 + { IBM423 cp423 ebcdic-cp-gr csIBM423 }
3948 + { IBM424 cp424 ebcdic-cp-he csIBM424 }
3949 + { IBM437 cp437 437 csPC8CodePage437 }
3950 + { IBM500 CP500 ebcdic-cp-be ebcdic-cp-ch csIBM500 }
3951 + { IBM775 cp775 csPC775Baltic }
3952 + { IBM850 cp850 850 csPC850Multilingual }
3953 + { IBM851 cp851 851 csIBM851 }
3954 + { IBM852 cp852 852 csPCp852 }
3955 + { IBM855 cp855 855 csIBM855 }
3956 + { IBM857 cp857 857 csIBM857 }
3957 + { IBM860 cp860 860 csIBM860 }
3958 + { IBM861 cp861 861 cp-is csIBM861 }
3959 + { IBM862 cp862 862 csPC862LatinHebrew }
3960 + { IBM863 cp863 863 csIBM863 }
3961 + { IBM864 cp864 csIBM864 }
3962 + { IBM865 cp865 865 csIBM865 }
3963 + { IBM866 cp866 866 csIBM866 }
3964 + { IBM868 CP868 cp-ar csIBM868 }
3965 + { IBM869 cp869 869 cp-gr csIBM869 }
3966 + { IBM870 CP870 ebcdic-cp-roece ebcdic-cp-yu csIBM870 }
3967 + { IBM871 CP871 ebcdic-cp-is csIBM871 }
3968 + { IBM880 cp880 EBCDIC-Cyrillic csIBM880 }
3969 + { IBM891 cp891 csIBM891 }
3970 + { IBM903 cp903 csIBM903 }
3971 + { IBM904 cp904 904 csIBBM904 }
3972 + { IBM905 CP905 ebcdic-cp-tr csIBM905 }
3973 + { IBM918 CP918 ebcdic-cp-ar2 csIBM918 }
3974 + { IBM1026 CP1026 csIBM1026 }
3975 + { EBCDIC-AT-DE csIBMEBCDICATDE }
3976 + { EBCDIC-AT-DE-A csEBCDICATDEA }
3977 + { EBCDIC-CA-FR csEBCDICCAFR }
3978 + { EBCDIC-DK-NO csEBCDICDKNO }
3979 + { EBCDIC-DK-NO-A csEBCDICDKNOA }
3980 + { EBCDIC-FI-SE csEBCDICFISE }
3981 + { EBCDIC-FI-SE-A csEBCDICFISEA }
3982 + { EBCDIC-FR csEBCDICFR }
3983 + { EBCDIC-IT csEBCDICIT }
3984 + { EBCDIC-PT csEBCDICPT }
3985 + { EBCDIC-ES csEBCDICES }
3986 + { EBCDIC-ES-A csEBCDICESA }
3987 + { EBCDIC-ES-S csEBCDICESS }
3988 + { EBCDIC-UK csEBCDICUK }
3989 + { EBCDIC-US csEBCDICUS }
3990 + { UNKNOWN-8BIT csUnknown8BiT }
3991 + { MNEMONIC csMnemonic }
3992 + { MNEM csMnem }
3993 + { VISCII csVISCII }
3994 + { VIQR csVIQR }
3995 + { KOI8-R csKOI8R }
3996 + { IBM00858 CCSID00858 CP00858 PC-Multilingual-850+euro }
3997 + { IBM00924 CCSID00924 CP00924 ebcdic-Latin9--euro }
3998 + { IBM01140 CCSID01140 CP01140 ebcdic-us-37+euro }
3999 + { IBM01141 CCSID01141 CP01141 ebcdic-de-273+euro }
4000 + { IBM01142 CCSID01142 CP01142 ebcdic-dk-277+euro ebcdic-no-277+euro }
4001 + { IBM01143 CCSID01143 CP01143 ebcdic-fi-278+euro ebcdic-se-278+euro }
4002 + { IBM01144 CCSID01144 CP01144 ebcdic-it-280+euro }
4003 + { IBM01145 CCSID01145 CP01145 ebcdic-es-284+euro }
4004 + { IBM01146 CCSID01146 CP01146 ebcdic-gb-285+euro }
4005 + { IBM01147 CCSID01147 CP01147 ebcdic-fr-297+euro }
4006 + { IBM01148 CCSID01148 CP01148 ebcdic-international-500+euro }
4007 + { IBM01149 CCSID01149 CP01149 ebcdic-is-871+euro }
4008 + { IBM1047 IBM-1047 }
4009 + { PTCP154 csPTCP154 PT154 CP154 Cyrillic-Asian }
4010 + { Amiga-1251 Ami1251 Amiga1251 Ami-1251 }
4011 + { UNICODE-1-1 csUnicode11 }
4012 + { CESU-8 csCESU-8 }
4013 + { BOCU-1 csBOCU-1 }
4014 + { UNICODE-1-1-UTF-7 csUnicode11UTF7 }
4015 + { ISO-8859-14 iso-ir-199 ISO_8859-14:1998 ISO_8859-14 latin8 iso-celtic
4016 + l8 }
4017 + { ISO-8859-15 ISO_8859-15 Latin-9 }
4018 + { ISO-8859-16 iso-ir-226 ISO_8859-16:2001 ISO_8859-16 latin10 l10 }
4019 + { GBK CP936 MS936 windows-936 }
4020 + { JIS_Encoding csJISEncoding }
4021 + { Shift_JIS MS_Kanji csShiftJIS }
4022 + { Extended_UNIX_Code_Packed_Format_for_Japanese csEUCPkdFmtJapanese
4023 + EUC-JP }
4024 + { Extended_UNIX_Code_Fixed_Width_for_Japanese csEUCFixWidJapanese }
4025 + { ISO-10646-UCS-Basic csUnicodeASCII }
4026 + { ISO-10646-Unicode-Latin1 csUnicodeLatin1 ISO-10646 }
4027 + { ISO-Unicode-IBM-1261 csUnicodeIBM1261 }
4028 + { ISO-Unicode-IBM-1268 csUnicodeIBM1268 }
4029 + { ISO-Unicode-IBM-1276 csUnicodeIBM1276 }
4030 + { ISO-Unicode-IBM-1264 csUnicodeIBM1264 }
4031 + { ISO-Unicode-IBM-1265 csUnicodeIBM1265 }
4032 + { ISO-8859-1-Windows-3.0-Latin-1 csWindows30Latin1 }
4033 + { ISO-8859-1-Windows-3.1-Latin-1 csWindows31Latin1 }
4034 + { ISO-8859-2-Windows-Latin-2 csWindows31Latin2 }
4035 + { ISO-8859-9-Windows-Latin-5 csWindows31Latin5 }
4036 + { Adobe-Standard-Encoding csAdobeStandardEncoding }
4037 + { Ventura-US csVenturaUS }
4038 + { Ventura-International csVenturaInternational }
4039 + { PC8-Danish-Norwegian csPC8DanishNorwegian }
4040 + { PC8-Turkish csPC8Turkish }
4041 + { IBM-Symbols csIBMSymbols }
4042 + { IBM-Thai csIBMThai }
4043 + { HP-Legal csHPLegal }
4044 + { HP-Pi-font csHPPiFont }
4045 + { HP-Math8 csHPMath8 }
4046 + { Adobe-Symbol-Encoding csHPPSMath }
4047 + { HP-DeskTop csHPDesktop }
4048 + { Ventura-Math csVenturaMath }
4049 + { Microsoft-Publishing csMicrosoftPublishing }
4050 + { Windows-31J csWindows31J }
4051 + { GB2312 csGB2312 }
4052 + { Big5 csBig5 }
4053 +}
4054 +
4055 +proc tcl_encoding {enc} {
4056 + global encoding_aliases
4057 + set names [encoding names]
4058 + set lcnames [string tolower $names]
4059 + set enc [string tolower $enc]
4060 + set i [lsearch -exact $lcnames $enc]
4061 + if {$i < 0} {
4062 + # look for "isonnn" instead of "iso-nnn" or "iso_nnn"
4063 + if {[regsub {^iso[-_]} $enc iso encx]} {
4064 + set i [lsearch -exact $lcnames $encx]
4065 + }
4066 + }
4067 + if {$i < 0} {
4068 + foreach l $encoding_aliases {
4069 + set ll [string tolower $l]
4070 + if {[lsearch -exact $ll $enc] < 0} continue
4071 + # look through the aliases for one that tcl knows about
4072 + foreach e $ll {
4073 + set i [lsearch -exact $lcnames $e]
4074 + if {$i < 0} {
4075 + if {[regsub {^iso[-_]} $e iso ex]} {
4076 + set i [lsearch -exact $lcnames $ex]
4077 + }
4078 + }
4079 + if {$i >= 0} break
4080 + }
4081 + break
4082 + }
4083 + }
4084 + if {$i >= 0} {
4085 + return [lindex $names $i]
4086 + }
4087 + return {}
4088 +}
4089 +
4090 # defaults...
4091 set datemode 0
4092 set diffopts "-U 5 -p"
4093 set wrcomcmd "git-diff-tree --stdin -p --pretty"
4094
3819 -set gitencoding ""
4095 +set gitencoding {}
4096 catch {
4097 set gitencoding [exec git-repo-config --get i18n.commitencoding]
4098 }
4099 if {$gitencoding == ""} {
3824 - set gitencoding "utf-8"
4100 + set gitencoding "utf-8"
4101 +}
4102 +set tclencoding [tcl_encoding $gitencoding]
4103 +if {$tclencoding == {}} {
4104 + puts stderr "Warning: encoding $gitencoding is not supported by Tcl/Tk"
4105 }
4106
4107 set mainfont {Helvetica 9}