summaryrefslogtreecommitdiff
path: root/lib/encoding.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/encoding.tcl')
-rw-r--r--lib/encoding.tcl14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/encoding.tcl b/lib/encoding.tcl
index 7f06b0d47f..e186b0c569 100644
--- a/lib/encoding.tcl
+++ b/lib/encoding.tcl
@@ -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
+}