git-gui: Cleanup handling of the default encoding.
- Make diffs and blame default to the system (locale) encoding instead of hard-coding UTF-8. - Add a gui.encoding option to allow overriding it. - gitattributes still have the final word. The rationale for this is Windows support: 1) Windows people are accustomed to using legacy encodings for text files. For many of them defaulting to utf-8 will be counter-intuitive. 2) Windows doesn't support utf-8 locales, and switching the system encoding is a real pain. Thus the option. This patch also adds proper encoding conversion to Apply Hunk/Line. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Tested-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:

committed by
Shawn O. Pearce

parent
696235c6c1
commit
72e6b00202
@ -274,3 +274,17 @@ proc tcl_encoding {enc} {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
proc get_path_encoding {path} {
|
||||
set tcl_enc [tcl_encoding [get_config gui.encoding]]
|
||||
if {$tcl_enc eq {}} {
|
||||
set tcl_enc [encoding system]
|
||||
}
|
||||
if {$path ne {}} {
|
||||
set enc2 [tcl_encoding [gitattr $path encoding $tcl_enc]]
|
||||
if {$enc2 ne {}} {
|
||||
set tcl_enc $enc2
|
||||
}
|
||||
}
|
||||
return $tcl_enc
|
||||
}
|
||||
|
Reference in New Issue
Block a user