unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to keep character encoding in text file...
Date: Fri, 06 Mar 2009 12:51:17 +0200	[thread overview]
Message-ID: <uprguncuy.fsf@gnu.org> (raw)
In-Reply-To: <gr4sl.9858$cu3.5293@uutiset.elisa.fi>

> From: Marko Myllymaki <firstname.lastname@iki.fi>
> Date: Fri, 06 Mar 2009 09:39:56 +0200
> 
> Eli Zaretskii wrote:
> >> So... if I load UTF-8 encoded file, emacs always saves it that way. If I 
> >> open latin1-encoded file, it should keep it in the original encoding.
> > 
> > Yes, that's how it's supposed to work, if you don't let any
> > non-Latin-1 characters creep in.
> 
> Okay, that might be the problem... because my system defaults to UTF-8, 
> I guess that there is some keyboard input encoding in emacs which uses 
> UTF-8.

No, that shouldn't in itself be a problem, as long as the characters
your keyboard input inserts are encodable in Latin-1.

When Emacs receives keyboard input, it first decodes all the
characters into its internal representation.  After such decoding, it
no longer matters how the characters were transmitted to Emacs, only
if they have a valid encoding in Latin-1.

In other words, keyboard input encoding has no direct relation to when
Emacs decides that the original file's encoding cannot be used to save
the modified buffer.

> Therefore if I enter "baz" in latin1 buffer, everything is okay, but 
> "foobar åäö" has some UTF-8 and it then forces buffer encoding to UTF-8...

All 3 characters you cited above are encodable in Latin-1, so this
cannot be the problem.  You need to find out (e.g., by using the 
"C-u C-x =" command on suspect characters) which one of the characters
you typed cannot be encoded in Latin-1.

Which Emacs version is that, by the way?





      parent reply	other threads:[~2009-03-06 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 11:17 How to keep character encoding in text file Marko Myllymaki
2009-03-05 13:33 ` Pascal J. Bourguignon
2009-03-06  7:54   ` Marko Myllymaki
2009-03-05 18:50 ` Eli Zaretskii
     [not found] ` <mailman.2443.1236279043.31690.help-gnu-emacs@gnu.org>
2009-03-06  7:39   ` Marko Myllymaki
2009-03-06  8:21     ` Pascal J. Bourguignon
2009-03-06  9:44       ` Peter Dyballa
2009-03-06 10:13         ` Nikolaj Schumacher
     [not found]       ` <mailman.2491.1236332716.31690.help-gnu-emacs@gnu.org>
2009-03-06 10:12         ` Pascal J. Bourguignon
2009-03-06 10:57       ` Peter Dyballa
     [not found]       ` <mailman.2504.1236337060.31690.help-gnu-emacs@gnu.org>
2009-03-07  9:05         ` Marko Myllymaki
2009-03-06 10:51     ` Eli Zaretskii [this message]

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=uprguncuy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).