Re: Can someone please comment on this short program

Christophe Fergeau wrote:
I haven't yet found a way to make an Uri work when pointing to a file which name contains umlauts, please help.

Maybe that's an encoding issue, ie t� is encoded in UTF-8 on the disk
while you are trying to read t� encoded in ISO8859-1 from your
program ?

Hm, yes I think you're right. I have tried executing the code like this now:

	UriPtr uri = Uri::create(get_uri_from_local_path(home_dir));
	uri = uri->append_file_name(Glib::filename_to_utf8(filename));
	std::cout << "Uri: " << uri->to_string() << " | exists: ";
	std::cout << std::boolalpha << uri->uri_exists() << std::endl;

matthias:testing$ G_FILENAME_ENCODING=ISO-8859-1 ./a.out
Uri: file:///home/matthias | exists: true
Uri: file:///home/matthias/t%C3%A4st | exists: true
Uri: file:///home/matthias/t%25E4st | exists: false

The problem seems to be that Emacs is encoding the name "t�" in ISO-8859-1 instead of UTF-8. This would at least explain the problem with this test case, where the string was hardwired into the code...

So, charset conversion has struck me again! Great. I'm going /nuts/ over this issue, seriously, I'm struggling with these kinds of problems for months already without getting productive in any way. Maybe I should consider porting my code to Python or so, it's getting annoying... *sigh*

Thanks Christophe.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]