From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kenichi Handa <handa@ni.aist.go.jp>
Cc: lekktu@gmail.com, eliz@gnu.org, jasonr@f2s.com, emacs-devel@gnu.org
Subject: Re: Encoding for a file containing filenames?
Date: Fri, 09 Nov 2007 11:25:50 -0500 [thread overview]
Message-ID: <jwvk5orgzk2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1IqRCQ-0003fR-4Z@etlken.m17n.org> (Kenichi Handa's message of "Fri, 09 Nov 2007 19:34:54 +0900")
>>>> But it will fail in Emacs-22 if the file (which contains file names)
>>>> contains chars that Emacs-22 doesn't know how to encode to (and decode
>>>> from) utf-8.
>> > Are there any such chars that are likely to be used in filenames? Or is it
>> > just the mule specific charsets that Emacs-22 cannot encode as utf-8.
>> It's actually a bit worse: it shouldn't just be encodable with utf-8,
>> but it should also be the case that encoding to utf-8 and back should
>> return the exact same string (since these are filenames and will be
>> compared with simple byte-comparison in the kernel).
> I think the important thing is to assure the round-trip of
> decode&encode (not encode&decode).
Are you sure? The situation is that we have a file name as an Emacs
string (i.e. decoded say from "locale" coding system) and we need to
store it into a file to load it back in a later Emacs invocation (at
which point we may use it to access the file, using hopefully the same
"locale" coding system).
So what needs to be byte-preserving is really:
locale-decode -> utf8-encode -> utf8-decode -> locale-encode
So as Eli points out, if locale is utf-8 there shouldn't be any problem.
In any case, I'd go with utf-8.
Stefan
next prev parent reply other threads:[~2007-11-09 16:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 15:05 Encoding for a file containing filenames? Juanma Barranquero
2007-11-08 16:32 ` Stefan Monnier
2007-11-08 16:49 ` Juanma Barranquero
2007-11-08 20:50 ` Eli Zaretskii
2007-11-08 22:38 ` Stefan Monnier
2007-11-08 23:42 ` Jason Rumney
2007-11-09 4:01 ` Stefan Monnier
2007-11-09 10:03 ` Eli Zaretskii
2007-11-09 11:05 ` Jan Djärv
2007-11-09 11:07 ` Andreas Schwab
2007-11-09 11:53 ` Eli Zaretskii
2007-11-09 12:15 ` Jan Djärv
2007-11-09 12:16 ` Kenichi Handa
2007-11-09 12:54 ` Andreas Schwab
2007-11-09 14:01 ` Eli Zaretskii
2007-11-09 10:34 ` Kenichi Handa
2007-11-09 16:25 ` Stefan Monnier [this message]
2007-11-10 1:10 ` Kenichi Handa
2007-11-09 0:41 ` Kenichi Handa
2007-11-09 0:50 ` Juanma Barranquero
2007-11-09 1:05 ` Kenichi Handa
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=jwvk5orgzk2.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=handa@ni.aist.go.jp \
--cc=jasonr@f2s.com \
--cc=lekktu@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).