* Encodings in Emacs.
@ 2003-05-19 9:27 Nacho
2003-05-19 9:57 ` Oliver Scholz
0 siblings, 1 reply; 7+ messages in thread
From: Nacho @ 2003-05-19 9:27 UTC (permalink / raw)
Hello.
I have been using Emacs to write and edit japanese files and I would
like to ask you something I have not found how to do.
When I write text, I know how to change the encoding of the buffer to
save it with the encoding I want, for example, EUC-JP, ShiftJIS, etc.
When I open it again, I have not to tell Emacs the encofing of the
file, he knows the encoding used.
How can I know in what encoding is the file?
Also, if I want to read a file in a specific encoding, how can I do
that? Or similarly, to change the encoding of a buffer but re-decofing
it. That is, if I change the encoding with M-x
set-buffer-file-coding-system it doesnt reencode the buffer. The use I
want to do to this is when I read a file with several codings mixed
(ShiftJIS and EUC-JP) and I want to read both.
Thanks a lot in advance.
Best regards.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 9:27 Encodings in Emacs Nacho
@ 2003-05-19 9:57 ` Oliver Scholz
2003-05-19 13:23 ` Nacho
2003-05-19 13:56 ` Stefan Monnier
0 siblings, 2 replies; 7+ messages in thread
From: Oliver Scholz @ 2003-05-19 9:57 UTC (permalink / raw)
Nacho <ncc1701zzz@hotmail.com> writes:
[...]
> When I write text, I know how to change the encoding of the buffer to
> save it with the encoding I want, for example, EUC-JP, ShiftJIS, etc.
>
> When I open it again, I have not to tell Emacs the encofing of the
> file, he knows the encoding used.
>
> How can I know in what encoding is the file?
On the left side of the modeline there is a small indicator that is
meant to tell the file encoding of the current buffer. For example
for UTF-8 its is "u", for Latin-1 it is "1". You could look at that.
Or you could look at the value of the variable
`buffer-file-coding-system' with `C-h v'.
> Also, if I want to read a file in a specific encoding, how can I do
> that? Or similarly, to change the encoding of a buffer but re-decofing
> it. That is, if I change the encoding with M-x
> set-buffer-file-coding-system it doesnt reencode the buffer. The use I
> want to do to this is when I read a file with several codings mixed
> (ShiftJIS and EUC-JP) and I want to read both.
[...]
When visiting a file, Emacs decodes that file into its internal
encoding `emacs-mule'. Emacs encodes this internal format then again,
when writing out the contents of the buffer. So when you do `C-x RET
f' (`set-buffer-file-coding-system') you don't change the encoding of
the buffer, you only tell Emacs to use another encoding when writing
the contents of the buffer out.
So the only way to get what you want is to tell Emacs which coding
system it should use to read that file *before* Emacs visits it. You
can do this with `C-x RET c'. For example:
`C-x RET c shift_jis RET C-x f your-file.txt RET'
But cautiion: I am not familiar with the encodings you mentioned, but
I think when you have a file with several encodings you will break
the parts with the "other" encodings, when you save that file.
Oliver
--
30 Floréal an 211 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 9:57 ` Oliver Scholz
@ 2003-05-19 13:23 ` Nacho
2003-05-19 14:17 ` Stefan Monnier
2003-05-19 13:56 ` Stefan Monnier
1 sibling, 1 reply; 7+ messages in thread
From: Nacho @ 2003-05-19 13:23 UTC (permalink / raw)
Hello Oliver
Oliver Scholz <alkibiades@gmx.de> writes:
> On the left side of the modeline there is a small indicator that is
> meant to tell the file encoding of the current buffer. For example
> for UTF-8 its is "u", for Latin-1 it is "1". You could look at that.
>
> Or you could look at the value of the variable
> `buffer-file-coding-system' with `C-h v'.
>
Thanks. it was what I was looking for ;) I found te modeline a little
confusing. Right now it is --1=:**-F1, I suppose that I should read
more manuals ;)
> When visiting a file, Emacs decodes that file into its internal
> encoding `emacs-mule'. Emacs encodes this internal format then again,
> when writing out the contents of the buffer. So when you do `C-x RET
> f' (`set-buffer-file-coding-system') you don't change the encoding of
> the buffer, you only tell Emacs to use another encoding when writing
> the contents of the buffer out.
Yes, I noticed that.
> So the only way to get what you want is to tell Emacs which coding
> system it should use to read that file *before* Emacs visits it. You
> can do this with `C-x RET c'. For example:
> `C-x RET c shift_jis RET C-x f your-file.txt RET'
Great! now I can open the .txt files both in EUC-JP and ShiftJIS
without problems, thans.
>
> But cautiion: I am not familiar with the encodings you mentioned, but
> I think when you have a file with several encodings you will break
> the parts with the "other" encodings, when you save that file.
It works fine. It doesnt do auto-detection, but I am used to the
"garbage" I get if I miss the coding, it looks different and I can
reopen the files with the right format.
Thanks for your help.
Best regards.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 13:23 ` Nacho
@ 2003-05-19 14:17 ` Stefan Monnier
2003-05-19 18:26 ` Eli Zaretskii
2003-05-20 8:59 ` Nacho
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2003-05-19 14:17 UTC (permalink / raw)
> Thanks. it was what I was looking for ;) I found te modeline a little
> confusing. Right now it is --1=:**-F1, I suppose that I should read
> more manuals ;)
If you use a window-system, you can move your move over the `1'
and you'll get a little message telling you what it means.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 14:17 ` Stefan Monnier
@ 2003-05-19 18:26 ` Eli Zaretskii
2003-05-20 8:59 ` Nacho
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2003-05-19 18:26 UTC (permalink / raw)
> From: "Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu>
> Newsgroups: gnu.emacs.help
> Date: 19 May 2003 10:17:34 -0400
>
> If you use a window-system, you can move your move over the `1'
^^^^^^^^^
Stefan meant to say "your mouse".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 14:17 ` Stefan Monnier
2003-05-19 18:26 ` Eli Zaretskii
@ 2003-05-20 8:59 ` Nacho
1 sibling, 0 replies; 7+ messages in thread
From: Nacho @ 2003-05-20 8:59 UTC (permalink / raw)
Hello Stefan.
I saw it at home ;) thanks. I sometimes read/write news from work,
doing an ssh to home computer, and reading it on a terminal.
Thanks.
"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:
>> Thanks. it was what I was looking for ;) I found te modeline a little
>> confusing. Right now it is --1=:**-F1, I suppose that I should read
>> more manuals ;)
>
> If you use a window-system, you can move your move over the `1'
> and you'll get a little message telling you what it means.
>
>
> Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Encodings in Emacs.
2003-05-19 9:57 ` Oliver Scholz
2003-05-19 13:23 ` Nacho
@ 2003-05-19 13:56 ` Stefan Monnier
1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2003-05-19 13:56 UTC (permalink / raw)
> So the only way to get what you want is to tell Emacs which coding
> system it should use to read that file *before* Emacs visits it. You
> can do this with `C-x RET c'. For example:
> `C-x RET c shift_jis RET C-x f your-file.txt RET'
^^^
C-f of course
> But cautiion: I am not familiar with the encodings you mentioned, but
> I think when you have a file with several encodings you will break
> the parts with the "other" encodings, when you save that file.
There were indeed such bug in Emacs-20 and I'm sure there are still
some in Emacs-21, but note that it shouldn't happen and if you get
such lossage, you should report it as a bug with M-x report-emacs-bug.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-05-20 8:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-19 9:27 Encodings in Emacs Nacho
2003-05-19 9:57 ` Oliver Scholz
2003-05-19 13:23 ` Nacho
2003-05-19 14:17 ` Stefan Monnier
2003-05-19 18:26 ` Eli Zaretskii
2003-05-20 8:59 ` Nacho
2003-05-19 13:56 ` Stefan Monnier
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).