From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Exporting non utf8 org documents Date: Wed, 6 Jan 2010 09:26:35 +0100 Message-ID: <6B5F0F7A-F055-435F-ADE2-846E99649B1D@gmail.com> References: <87my1tcu59.fsf@missioncriticalit.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSSP4-0001dW-1L for emacs-orgmode@gnu.org; Wed, 06 Jan 2010 04:42:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSSOz-0001d4-D1 for emacs-orgmode@gnu.org; Wed, 06 Jan 2010 04:42:09 -0500 Received: from [199.232.76.173] (port=40536 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSSOz-0001d1-2L for emacs-orgmode@gnu.org; Wed, 06 Jan 2010 04:42:05 -0500 Received: from mail-ew0-f224.google.com ([209.85.219.224]:42310) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSSOy-00050A-Jp for emacs-orgmode@gnu.org; Wed, 06 Jan 2010 04:42:04 -0500 Received: by ewy24 with SMTP id 24so20149286ewy.26 for ; Wed, 06 Jan 2010 01:42:03 -0800 (PST) In-Reply-To: <87my1tcu59.fsf@missioncriticalit.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Francesco Pizzolante Cc: mailing-list-org-mode Hi Francesco, here is a possible solution: Please get the latest git version of org-mode. Then put the following =20= code into .emacs: (defun my-org-export-latex-fix-inputenc () "Set the codingsystem in inputenc to what the buffer is." (let* ((cs buffer-file-coding-system) (opt (latexenc-coding-system-to-inputenc cs))) (when opt (goto-char (point-min)) (while (re-search-forward "\\\\usepackage\\[\\(.*?\\)\\]=20 {inputenc}" nil t) (goto-char (match-beginning 1)) (delete-region (match-beginning 1) (match-end 1)) (insert opt)) (save-buffer)))) (eval-after-load "org-latex" '(add-hook 'org-export-latex-after-save-hook 'my-org-export-latex-fix-inputenc)) Let me know how it goes..... - Carsten On Dec 8, 2009, at 5:22 PM, Francesco Pizzolante wrote: > Hi, > > I have colleagues who are writing Org documents with latin-1 =20 > encoding and when > I export these documents to LaTeX I run into problems, because Org =20 > assumes > utf8. > > Here's a little example: > > --8<---------------cut here---------------start------------->8--- > #+LATEX_CLASS: article > > * Ceci est un test > > Voici un petit texte r=E9dig=E9 en fran=E7ais. > > * COMMENT Setup > > # This is for the sake of Emacs. > # Local Variables: > # coding: iso-latin-1 > # End: > --8<---------------cut here---------------end--------------->8--- > > The exportation to LaTeX gives the following result: > > --8<---------------cut here---------------start------------->8--- > % Created 2009-12-08 mar. 17:10 > \documentclass[11pt]{article} > \usepackage[utf8]{inputenc} > \usepackage[T1]{fontenc} > \usepackage{graphicx} > \usepackage{longtable} > \usepackage{float} > \usepackage{wrapfig} > \usepackage{soul} > \usepackage{amssymb} > \usepackage{hyperref} > \usepackage{xcolor} > \usepackage{listings} > > \title{org-french} > \author{Francesco Pizzolante} > \date{08 d=E9cembre 2009} > > \begin{document} > > \maketitle > > \setcounter{tocdepth}{3} > \tableofcontents > \vspace*{1cm} > > \section{Ceci est un test} > \label{sec-1} > > > Voici un petit texte r=E9dig=E9 en fran=E7ais. > > > > \end{document} > --8<---------------cut here---------------end--------------->8--- > > When compiling, due to the \usepackage[utf8]{inputenc} directive, I =20= > get this > error: > > ERROR: Package utf8x Error: MalformedUTF-8sequence. > > > In order to fix this issue, I see the following solutions: > > - Would it be possible for Org to automatically get the coding =20 > system of the > buffer and then generate the correct option for the inputenc package? > > or > > - Would it be possible to have a variable like #+CODING-SYSTEM: iso-=20= > latin-1 > which would be used to generate the correct option for the inputenc =20= > package? > > Any other proposition or idea is welcome. > > In addition, Org should use the `utf8x' option (instead of `utf8') =20 > which > enables to handle unbreakable spaces (useful in french). > > Thanks. > > Regards, > Francesco > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten