0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 19:37:52 +00:00

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>
This commit is contained in:
Nicolas Goaziou 2013-11-11 10:09:21 +01:00
parent 6cc028bf74
commit fb239ceb7a

View file

@ -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"