Re: Can someone please comment on this short program
- From: Matthias Kaeppler <matthias finitestate org>
- To: gnome-vfs-list gnome org
- Subject: Re: Can someone please comment on this short program
- Date: Tue, 13 Dec 2005 21:18:44 +0100
Nelson Benítez wrote:
On Tue, December 13, 2005 1:39 pm, Murray Cumming said:
Some tips for encoding charsets troubles:
Isn't this for file contents, not file names?
Yes, I think the problem is the emacs c file that contain the filename is
on iso-8859-x and so the filename, while if the c file were in utf8 and
so the filename then didn't failed. That's what I understood.
The whole point isn't about Emacs anyway. The problem to my
understanding lies in the Uri class expecting UTF-8 encoded strings,
while FileInfo handling strings in the locale's encoding; both don't go
well together for non-ASCII characters.
Example:
You read the file 'äöü' from the disk which name is encoded in ISO-8859-15:
// returns std::string in the locale's encoding
std::string filename = dirhandle.read_next()->get_name();
You want to create an URI object from this filename, but...
// error! Invalid byte sequence in conversion input
RefPtr<Uri> uri = Uri::create(filename);
Uri::create() expects UTF-8, so you /have/ to convert the filename to
UTF-8 using the glib conversion functions:
RefPtr<Uri> uri = Uri::create(filename_to_utf8(filename));
No conversion error anymore, but now the Uri object is effectively
useless, because it doesn't point to an existing entity anymore; there
is no file on the system by the name the conversion yields.
And /that/ is the dilemma; regardless how you bend and turn it, one of
the actions will fail.
- Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]