Re: g_filename_to_uri() issue in glib-win32



2012/5/22 John Emmas <johne53 tiscali co uk>:
> So for example, if the input string is "Göran" (encoded as UTF-8) I get the wrong output (hopefully, you can see that the 'o' has an umlaut).  g_filename_to_uri encodes 6 characters and returns "G%C3%B6ran" instead of encoding just 5 characters to return the correct URI string "G%F6ran".

What you get is an URI encoding of the UTF-8 bytes. I think this is
the expected and correct behavior: there are multiple incompatible
locale encodings and there's no way for this function to know what
encoding you want to use for the URI. It would also fail if you had
characters not representable in the locale encoding.

This is at most a documentation bug. It should be stated that this
function converts the string byte-by-byte, and everything outside of
the 0-127 range is converted to hex escapes. (I think this is the only
sensible behavior for this function.)

Regards, Krzysztof


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