unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* switching between locales (esp. iso-8859-1 and iso-8859-15)
@ 2005-03-10 17:15 Tapani Tarvainen
  2005-03-10 18:24 ` Reiner Steib
  2005-03-10 18:34 ` Kevin Rodgers
  0 siblings, 2 replies; 8+ messages in thread
From: Tapani Tarvainen @ 2005-03-10 17:15 UTC (permalink / raw)



Is there any easy way to tell emacs to reinterpret (and display)
a buffer with a different encoding?

This sounds so basic but I can't figure out how to do it,
other than starting a new instance of emacs with different
locale.

In particular, I frequently have to deal with files in ISO-8859-1
and ISO-8859-15 codings, and while emacs is perfectly able to
display either correctly if it starts with the right foot, er,
with correct locale, I can't figure out how to make it change
its opinion of the encoding once it has opened the file.

E.g., if my locale is set to something with ISO-8859-1 encoding
and I open a file containing the euro symbol, it is displayed
incorrectly. That's fine, emacs had no way of knowing, but how
can I then tell emacs what the correct encoding is?

For now I simply exit emacs and start another with
LC_ALL=fi_FI@euro emacs
or something similar, but I hate doing that. It should
not be necessary to start a new emacs simply to edit
files with different encodings.

Please tell me I've missed something obvious.
It can't be this hard.

-- 
Tapani Tarvainen

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-10 17:15 switching between locales (esp. iso-8859-1 and iso-8859-15) Tapani Tarvainen
@ 2005-03-10 18:24 ` Reiner Steib
  2005-03-11  4:25   ` Tapani Tarvainen
  2005-03-10 18:34 ` Kevin Rodgers
  1 sibling, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2005-03-10 18:24 UTC (permalink / raw)


On Thu, Mar 10 2005, Tapani Tarvainen wrote:

> In particular, I frequently have to deal with files in ISO-8859-1
> and ISO-8859-15 codings, and while emacs is perfectly able to
> display either correctly if it starts with the right foot, er,
> with correct locale, I can't figure out how to make it change
> its opinion of the encoding once it has opened the file.

`C-x RET c NEWCODING-SYSTEM RET C-x C-v RET'

Emacs 22 will have a more simple command for this task:

,----[ `C-h k C-x RET r' ]
| C-x RET r runs the command revert-buffer-with-coding-system
|    which is an interactive compiled Lisp function in `international/mule'.
| It is bound to C-x RET r, <menu-bar> <options> <mule>
| <set-various-coding-system> <revert-buffer-with-coding-system>.
| (revert-buffer-with-coding-system CODING-SYSTEM &optional FORCE)
| 
| Visit the current buffer's file again using coding system CODING-SYSTEM.
| For a list of possible values of CODING-SYSTEM, use M-x list-coding-systems.
`----

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

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-10 17:15 switching between locales (esp. iso-8859-1 and iso-8859-15) Tapani Tarvainen
  2005-03-10 18:24 ` Reiner Steib
@ 2005-03-10 18:34 ` Kevin Rodgers
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-03-10 18:34 UTC (permalink / raw)


Tapani Tarvainen wrote:
> Is there any easy way to tell emacs to reinterpret (and display)
> a buffer with a different encoding?
> 
> This sounds so basic but I can't figure out how to do it,
> other than starting a new instance of emacs with different
> locale.
> 
> In particular, I frequently have to deal with files in ISO-8859-1
> and ISO-8859-15 codings, and while emacs is perfectly able to
> display either correctly if it starts with the right foot, er,
> with correct locale, I can't figure out how to make it change
> its opinion of the encoding once it has opened the file.
> 
> E.g., if my locale is set to something with ISO-8859-1 encoding
> and I open a file containing the euro symbol, it is displayed
> incorrectly. That's fine, emacs had no way of knowing, but how
> can I then tell emacs what the correct encoding is?
> 
> For now I simply exit emacs and start another with
> LC_ALL=fi_FI@euro emacs
> or something similar, but I hate doing that. It should
> not be necessary to start a new emacs simply to edit
> files with different encodings.
> 
> Please tell me I've missed something obvious.
> It can't be this hard.

C-x RET c iso-8859-15 RET
C-x C-v RET

-- 
Kevin Rodgers

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-10 18:24 ` Reiner Steib
@ 2005-03-11  4:25   ` Tapani Tarvainen
  2005-03-11 17:41     ` Kevin Rodgers
  2005-03-15 20:36     ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Tapani Tarvainen @ 2005-03-11  4:25 UTC (permalink / raw)


Reiner Steib <reinersteib+from-uce@imap.cc> writes:

> `C-x RET c NEWCODING-SYSTEM RET C-x C-v RET'

Thank you (and Kevin Rogers as well).
This indeed fixes the display as it should.
It only works if the buffer has been saved though, 
but that's no big problem.

Is there a similar simple way to change keyboard behaviour? 
Now, if emacs is started with locale (LC_CTYPE) set to
some ISO-8859-15 locale the euro key on my keyboard
works as it should, and keys corresponding to characters
not in ISO-8859-15 do not, whereas with ISO-8859-1
locale the reverse is true. 

- Actually I just found a good (and with afterthought
obvious) workaround: set LC_CTYPE to some UTF-8 locale,
and both keys work (and combined with suitable settings
for coding system preference order it won't even cause 
files to be saved by utf-8 by default either).
So this is just idle curiosity at this point, but I'd
still like to know is there a simple way to effectively 
change emacs behaviour as if locale had been changed
without restarting it?

-- 
Tapani Tarvainen

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-11  4:25   ` Tapani Tarvainen
@ 2005-03-11 17:41     ` Kevin Rodgers
  2005-03-15 15:11       ` Tapani Tarvainen
  2005-03-15 20:36     ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Kevin Rodgers @ 2005-03-11 17:41 UTC (permalink / raw)


Tapani Tarvainen wrote:> Is there a similar simple way to change 
keyboard behaviour?
> Now, if emacs is started with locale (LC_CTYPE) set to
> some ISO-8859-15 locale the euro key on my keyboard
> works as it should, and keys corresponding to characters
> not in ISO-8859-15 do not, whereas with ISO-8859-1
> locale the reverse is true. 
> 
> - Actually I just found a good (and with afterthought
> obvious) workaround: set LC_CTYPE to some UTF-8 locale,
> and both keys work (and combined with suitable settings
> for coding system preference order it won't even cause 
> files to be saved by utf-8 by default either).
> So this is just idle curiosity at this point, but I'd
> still like to know is there a simple way to effectively 
> change emacs behaviour as if locale had been changed
> without restarting it?

Does `C-x RET l' work?

-- 
Kevin Rodgers

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-11 17:41     ` Kevin Rodgers
@ 2005-03-15 15:11       ` Tapani Tarvainen
  2005-03-15 17:05         ` Kevin Rodgers
  0 siblings, 1 reply; 8+ messages in thread
From: Tapani Tarvainen @ 2005-03-15 15:11 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> > I'd still like to know is there a simple way to effectively change
> > emacs behaviour as if locale had been changed without restarting
> > it?

> Does `C-x RET l' work?

No. (Or it does "work" in the sense that it sets the emacs language
environment, but that does not change the way current buffer is
displayed or keystrokes are interpreted.)

-- 
Tapani Tarvainen

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-15 15:11       ` Tapani Tarvainen
@ 2005-03-15 17:05         ` Kevin Rodgers
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-03-15 17:05 UTC (permalink / raw)


Tapani Tarvainen wrote:
 > Kevin Rodgers <ihs_4664@yahoo.com> writes:
 >>>I'd still like to know is there a simple way to effectively change
 >>>emacs behaviour as if locale had been changed without restarting
 >>>it?
 >
 >>Does `C-x RET l' work?
 >
 > No. (Or it does "work" in the sense that it sets the emacs language
 > environment, but that does not change the way current buffer is
 > displayed or keystrokes are interpreted.)

Well of course it won't affect the way the current buffer is displayed
-- the only way that I know of to do that is to re-visit the file with
the `C-x RET c ... C-x C-v RET' command posted earlier.  I figured `C-x
RET l' would do the right thing for input, but maybe `C-x RET k' is
better.

-- 
Kevin Rodgers

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

* Re: switching between locales (esp. iso-8859-1 and iso-8859-15)
  2005-03-11  4:25   ` Tapani Tarvainen
  2005-03-11 17:41     ` Kevin Rodgers
@ 2005-03-15 20:36     ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2005-03-15 20:36 UTC (permalink / raw)


> still like to know is there a simple way to effectively 
> change emacs behaviour as if locale had been changed
> without restarting it?

Not really, no.
But Emacs-CVS should accept the euro key just fine in any locale.


        Stefan

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

end of thread, other threads:[~2005-03-15 20:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-10 17:15 switching between locales (esp. iso-8859-1 and iso-8859-15) Tapani Tarvainen
2005-03-10 18:24 ` Reiner Steib
2005-03-11  4:25   ` Tapani Tarvainen
2005-03-11 17:41     ` Kevin Rodgers
2005-03-15 15:11       ` Tapani Tarvainen
2005-03-15 17:05         ` Kevin Rodgers
2005-03-15 20:36     ` Stefan Monnier
2005-03-10 18:34 ` Kevin Rodgers

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