summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-11-11 10:09:21 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-11-11 10:09:21 +0100
commitfb239ceb7ad71c2bcae2a64a50cf3cc50d8d0c3b (patch)
treebfcf08814bf8239a87e98cb296032ac4ce97a188
parent6cc028bf741e2986ce8dd913f2de1c56de0ab11b (diff)
downloadorg-mode-fb239ceb7ad71c2bcae2a64a50cf3cc50d8d0c3b.tar.gz
ox-texinfo: Fix incorrect @documentencoding
* lisp/ox-texinfo.el (org-texinfo-supported-coding-systems): New variable. (org-texinfo-template): Find appropriate encoding among those supported. Reported-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
-rw-r--r--lisp/ox-texinfo.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 29fbc07..5967978 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -410,6 +410,13 @@ set `org-texinfo-logfiles-extensions'."
this depth Texinfo will not recognize the nodes and will cause
errors. Left as a constant in case this value ever changes.")
+(defconst org-texinfo-supported-coding-systems
+ '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u")
+ "List of coding systems supported by Texinfo, as strings.
+Specified coding system will be matched against these strings.
+If two strings share the same prefix (e.g. \"ISO-8859-1\" and
+\"ISO-8859-15\"), the most specific one has to be listed first.")
+
;;; Internal Functions
@@ -695,9 +702,7 @@ holding export options."
;; `.' in text.
(dirspacing (- 29 (length dirtitle)))
(menu (org-texinfo-make-menu info 'main))
- (detail-menu (org-texinfo-make-menu info 'detailed))
- (coding-system (or org-texinfo-coding-system
- buffer-file-coding-system)))
+ (detail-menu (org-texinfo-make-menu info 'detailed)))
(concat
;; Header
header "\n"
@@ -705,8 +710,17 @@ holding export options."
;; Filename and Title
"@setfilename " info-filename "\n"
"@settitle " title "\n"
- (format "@documentencoding %s\n"
- (upcase (symbol-name coding-system))) "\n"
+ ;; Coding system.
+ (format
+ "@documentencoding %s\n"
+ (catch 'coding-system
+ (let ((case-fold-search t)
+ (name (symbol-name (or org-texinfo-coding-system
+ buffer-file-coding-system))))
+ (dolist (system org-texinfo-supported-coding-systems "UTF-8")
+ (when (org-string-match-p (regexp-quote system) name)
+ (throw 'coding-system system))))))
+ "\n"
(format "@documentlanguage %s\n" lang)
"\n\n"
"@c Version and Contact Info\n"