Subject: bug#6974: Emacs doesn't like Swedish ä (on w32)

From: Eli Zaretskii <[email-masked]>
Date: Fri, 03 Sep 2010 16:49:29 +0300

> Date: Fri, 03 Sep 2010 11:46:00 +0200
> From: Andreas Röhler <[email-masked]>
> CC: [email-masked]
> 
> > The most probable reason for Emacs not to decode the file correctly
> > (as UTF-8) is that the file includes some bytes that are invalid UTF-8
> > sequences.  What happens if you force UTF-8 with "C-x RET c" before
> > visiting the file with "C-x C-f"?
> >
> 
> All fine at the first glance than.
> 
> However, re-opening the newly saved buffer repeats the wrong display.

Sure, because the problem that caused Emacs to decode the file as
raw-text is still in the file.

> Also when saving, it always prompts for coding-system, suggests raw-text 
> first.

Expected, since there are problematic characters in the file.  Try
this:

 M-: (unencodable-char-position (point-min) (point-max) 'utf-8) RET

It should show you the first position in the buffer where you have a
character that cannot be encoded by UTF-8.  If all the characters can
be encoded by UTF-8, this will evaluate to nil.

> Setting buffer-file-coding-system explicitly to utf-8-unix, followed by 
> a save, doesn't change the wrong display after new opening.

And it shouldn't.