From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: Encodings in Emacs.
Date: Mon, 19 May 2003 11:57:31 +0200 [thread overview]
Message-ID: <ur86v8dis.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: m3r86vz3qx.fsf@terra.es
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é!
next prev parent reply other threads:[~2003-05-19 9:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-19 9:27 Encodings in Emacs Nacho
2003-05-19 9:57 ` Oliver Scholz [this message]
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
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=ur86v8dis.fsf@ID-87814.user.dfncis.de \
--to=alkibiades@gmx.de \
/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).