emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: emacs-orgmode@gnu.org, Julien Cubizolles <j.cubizolles@free.fr>
Subject: Re: encoding problem
Date: Fri, 01 Jun 2012 12:15:13 -0400	[thread overview]
Message-ID: <87hauvhuum.fsf@norang.ca> (raw)
In-Reply-To: <87aa0nphu9.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 1 Jun 2012 17:46:46 +0930")

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> Julien Cubizolles <j.cubizolles@free.fr> writes:
>>
>>> I'm having a very strange problem with character encoding. I write all
>>> my text files with emacs, with non-ascii characters (I'm french). I keep
>>> a copy of many files (latex/org/...) on separate machines using
>>> unison. Very often after a synchronization, the non-ascii charaters are
>>> completely displayed wrong (à for à, ç for ç) in the org files, but
>>> never in the latex files.
>>>
>>> I guess it's more an Emacs than org files but I can't see what's special
>>> in the org files that makes them more prone to such errors.
>>>
>>> Is there a way to *fix* easily these corruptions on a file, ie searching
>>> for all "weird" characters to replace ?
>>>
>>> How could I prevent this from happening again (checking/changing
>>> character encoding maybe ?)
>>>
>>> Thanks for your help,
>>>
>>> Julien.
>>
>> Hi Julien,
>>
>> I get prompts for encoding when saving/exporting (on Windows only) so I
>> put the following at the top of my org-files
>>
>> # -*- coding: utf-8 -*-
>>
>> which seems to fix the problem for me.  Maybe this will help?
>
> I used to have this problem and it was incredibly annoying.  I also
> started adding the line Bernt suggests but I kept forgetting for new
> files.  I finally solved this problem by adding the following lines to
> my emacs initialisation:
>
> #+begin_src emacs-lisp
> (prefer-coding-system 'utf-8)
> (set-charset-priority 'unicode)
> (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
> #+end_src
>
> I couldn't tell you which of these matter or whether they are all
> necessary but I don't have these problems any longer so I haven't
> investigated any further!

Thanks Eric!

I'll try this and drop my mode line setting in each org file.  I still
encounter this when archiving for the first time to a new file -- since
I'm archive utf-8 content and the new target org file prompts for
encoding with my current setup.

Regards,
Bernt

  reply	other threads:[~2012-06-01 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  9:55 encoding problem Julien Cubizolles
2012-05-30 16:29 ` Bernt Hansen
2012-06-01  8:16   ` Eric S Fraga
2012-06-01 16:15     ` Bernt Hansen [this message]
2012-06-01 16:31       ` Nick Dokos
2012-06-01 18:20         ` Bernt Hansen
2012-06-01 18:35           ` Nick Dokos
2012-06-02  8:49     ` Julien Cubizolles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hauvhuum.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=j.cubizolles@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).