unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Encoding Problems
@ 2006-03-07 12:38 Nicolas Keller
  2006-03-07 19:30 ` Peter Dyballa
  2006-03-07 21:06 ` Reiner Steib
  0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Keller @ 2006-03-07 12:38 UTC (permalink / raw)


Hi!

I have to use ISO-8859-1 encoding and therefore I have set the
following in my .emacs file:

(set-language-environment 'german)
(set-terminal-coding-system 'iso-latin-1)

As I use the ° character very often, I have written the following
function:

(global-set-key "\M-0"  'my-insert-grad)
(defun my-insert-grad () (interactive) (insert "°"))

Now, when I insert this character and then save the file, sometimes the
encoding chances without any feedback from ISO-8859-1 (C-h C =
iso-latin-1-unix) to UTF-8 (C-h C mule-utf-8-unix).

If I open the file in VI, insert the ° close the file, reopen it in
Emacs change something and save it again, the ° character leaves
untouched and the encoding stays as it is. So I guess I have to enhance
the function?

How can I tell Emacs to automatically keep the ISO-8859-1 encoding when
I save the file after inserting this character?

Thanks in advance,

Nicolas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Encoding Problems
  2006-03-07 12:38 Encoding Problems Nicolas Keller
@ 2006-03-07 19:30 ` Peter Dyballa
  2006-03-07 21:06 ` Reiner Steib
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Dyballa @ 2006-03-07 19:30 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 07.03.2006 um 13:38 schrieb Nicolas Keller:

> How can I tell Emacs to automatically keep the ISO-8859-1 encoding  
> when
> I save the file after inserting this character?

I'd use another encoding, one with € ...

	(prefer-coding-system        'iso-latin-9-unix)
	(prefer-coding-system        'iso-8859-15)

or in the file either among the first few lines:

	;; -*- mode: Emacs-Lisp; coding: iso-8859-15; -*-

or at its end:

	%
	% Local Variables:
	% mode: LaTeX
	% fill-column: 77
	% coding-system: iso-latin-9
	% End:

The differences between ISO Latin-1 and ISO Latin-9/0 are minimal and  
not to advantage for ISO Latin-1.

--
Mit friedvollen Grüßen

   Pete

Gut durch ist besser als unten durch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Encoding Problems
  2006-03-07 12:38 Encoding Problems Nicolas Keller
  2006-03-07 19:30 ` Peter Dyballa
@ 2006-03-07 21:06 ` Reiner Steib
  1 sibling, 0 replies; 3+ messages in thread
From: Reiner Steib @ 2006-03-07 21:06 UTC (permalink / raw)


On Tue, Mar 07 2006, Nicolas Keller wrote:

> I have to use ISO-8859-1 encoding and therefore I have set the
> following in my .emacs file:
>
> (set-language-environment 'german)
> (set-terminal-coding-system 'iso-latin-1)

Are you sure that the terminal really sends iso-latin-1?

> As I use the ° character very often, I have written the following
> function:
>
> (global-set-key "\M-0"  'my-insert-grad)
> (defun my-insert-grad () (interactive) (insert "°"))
>
> Now, when I insert this character and then save the file, sometimes the
> encoding chances without any feedback from ISO-8859-1 (C-h C =
> iso-latin-1-unix) to UTF-8 (C-h C mule-utf-8-unix).

I couldn't reproduce what you describe using a Latin locale
(LC_CTYPE=de_DE@euro).  But when I use LC_CTYPE=de_DE.utf8, I can
reproduce it.

I'd suggest to replace...

  (set-terminal-coding-system 'iso-latin-1)

with...

  (prefer-coding-system 'iso-latin-1)

BTW, instead of my-insert-grad, you could set it for the whole X11
session, e.g. on `Alt-R + 0' or `Alt-R + `':

xmodmap -e 'keysym 0 = 0 parenright degree'
xmodmap -e 'keysym grave = grave asciitilde degree'

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-07 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 12:38 Encoding Problems Nicolas Keller
2006-03-07 19:30 ` Peter Dyballa
2006-03-07 21:06 ` Reiner Steib

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).