g_filename_to_uri() issue in glib-win32



I'm using the Glib function g_filename_to_uri() in glib-win32 (version 2.24).  According to the documentation I should pass in a file path in the encoding format used by Glib (which on Windows is UTF-8).  However, if I pass in a UTF-8 string, this function translates it character-by-character (as if it was plain ASCII).  i.e. it doesn't recognise that the string is UTF-8.

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".

I can work around the problem by filtering my string through g_locale_from_utf8() before sending it to g_filename_to_uri() but I think that g_filename_to_uri() should be doing that for itself (either that - or the documentation's wrong).

Can anyone confirm if this is a bug or intended behaviour?  If it's a bug, is it fixed yet in the latest glib version?  Thanks though for an otherwise great product.

John Emmas


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