Discussion:
Using utf-8 and only utf-8
Maurí­cio
2008-08-26 02:38:14 UTC
Permalink
Hi,

Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?

Thanks,
Maurício
Peter Dyballa
2008-08-26 06:42:55 UTC
Permalink
Post by Maurí­cio
Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?
For example:

(prefer-coding-system 'utf-8)

It's more efficient to set in GNU Emacs' runtime environment the
variable LC_CTYPE to an UTF-8 value. This will make more internals
work in UTF-8.

--
Greetings

Pete

Remember: use logout to logout.
Nikolaj Schumacher
2008-08-26 10:57:55 UTC
Permalink
Post by Maurí­cio
Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?
Yes, edit `file-coding-system-alist'. But I'd leave some of the
exceptions (e.g. ".elc") in there.


regards,
Nikolaj Schumacher
Maurí­cio
2008-08-27 01:48:29 UTC
Permalink
Post by Nikolaj Schumacher
Post by Maurí­cio
Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?
Yes, edit `file-coding-system-alist'. But I'd leave some of the
exceptions (e.g. ".elc") in there.
regards,
Nikolaj Schumacher
I just added this to my .emacs:

(prefer-coding-system 'utf-8)
(modify-coding-system-alist 'file ".*" 'utf-8)

Is it the proper way of doing that? (Sorry,
beginner question…)
David Combs
2008-09-14 21:12:55 UTC
Permalink
Post by Peter Dyballa
Post by Nikolaj Schumacher
Post by Maurí­cio
Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?
Yes, edit `file-coding-system-alist'. But I'd leave some of the
exceptions (e.g. ".elc") in there.
regards,
Nikolaj Schumacher
(prefer-coding-system 'utf-8)
(modify-coding-system-alist 'file ".*" 'utf-8)
Is it the proper way of doing that? (Sorry,
beginner question…)
I get this same question, "what coding system?", sometimes, like
sometimes when grabbing some text from a wikipedia entry.

Not knowing anything about these coding systems, their history,
etc, I haven't a clue as to what to answer!

For someone like me often grabbing ascii[-like?] files from eg
wikipedia, would a choice of utf-8 be reasonable?

Again, it's for what seems and looks to me (on screen) like
plain old ascii.

And what would you have me stick into my .emacs, then?


THANK YOU!

David
ken
2008-09-15 13:28:58 UTC
Permalink
Post by David Combs
Post by Peter Dyballa
Post by Nikolaj Schumacher
Post by Maurí­cio
Is it possible to set something
in .emacs so that emacs will
always, no matter what, save any
file in utf-8 (even those that
were not utf-8 when they were
open)?
Yes, edit `file-coding-system-alist'. But I'd leave some of the
exceptions (e.g. ".elc") in there.
regards,
Nikolaj Schumacher
(prefer-coding-system 'utf-8)
(modify-coding-system-alist 'file ".*" 'utf-8)
Is it the proper way of doing that? (Sorry,
beginner question�)
I get this same question, "what coding system?", sometimes, like
sometimes when grabbing some text from a wikipedia entry.
Not knowing anything about these coding systems, their history,
etc, I haven't a clue as to what to answer!
For someone like me often grabbing ascii[-like?] files from eg
wikipedia, would a choice of utf-8 be reasonable?
Again, it's for what seems and looks to me (on screen) like
plain old ascii.
And what would you have me stick into my .emacs, then?
THANK YOU!
David
David,

This reply isn't going to answer your question directly, but hopefully
will be helpful, if not to you, then perhaps to someone else reading here.

To determine which character encoding a webpage is, what I do (in
Firefox) is click on "View", then run the mouse pointer down to
highlight "Character Encoding"; this brings up a submenu which will show
a little dot prepended to the character encoding used on that particular
page. Once in a while, if a more rare encoding is used, I'll have to
push the pointer further, onto "More encodings" and search around the
several submenus there before I find the sought-after prepended dot.



ken
Nikolaj Schumacher
2008-09-15 16:17:46 UTC
Permalink
Post by David Combs
I get this same question, "what coding system?", sometimes, like
sometimes when grabbing some text from a wikipedia entry.
Not knowing anything about these coding systems, their history,
etc, I haven't a clue as to what to answer!
For someone like me often grabbing ascii[-like?] files from eg
wikipedia, would a choice of utf-8 be reasonable?
What do you mean by grabbing? Copy & paste or downloading?
Post by David Combs
Again, it's for what seems and looks to me (on screen) like plain old
ascii.
If it really only contains ASCII characters, it doesn't matter if you
call it ASCII, UTF-8 or something like Latin-1. They only differ in the
way "other" characters are encoded. UTF-8 can encode pretty much every
character known to man, and is becoming more and more popular. It is a
very reasonable choice for storing data.

When it comes to receiving data, you'll have to rely on the sender to
specify the coding system. Wikipedia uses UTF-8, as you can see in the
HTML header.
Post by David Combs
And what would you have me stick into my .emacs, then?
Do you use unix? Then you only need to specify the correct locale
(e.g. en_US.UTF-8) and Emacs should pick it up.



regards,
Nikolaj Schumacher
David Combs
2008-09-22 20:02:53 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This reply isn't going to answer your question directly, but hopefully
will be helpful, if not to you, then perhaps to someone else reading here.
To determine which character encoding a webpage is, what I do (in
Firefox) is click on "View", then run the mouse pointer down to
highlight "Character Encoding"; this brings up a submenu which will show
a little dot prepended to the character encoding used on that particular
page. Once in a while, if a more rare encoding is used, I'll have to
push the pointer further, onto "More encodings" and search around the
several submenus there before I find the sought-after prepended dot.
ken
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFIzmL/8CeNiFrQkecRAlQSAJ9grgfBgs+OMxwJqUE7ejy+uMQexwCglZFq
izJehU17ztCpcu8QUjNjHMg=
=6jDC
-----END PGP SIGNATURE-----
Cool!


David

Continue reading on narkive:
Loading...