Win32: I'm confused about filename encoding



Hi!

I'm using gtkmm and libglademm on Windows, and got several reports
from users that they could not start the app (SharpConstruct). In the
console window, a message similar to this one is output:

I/O warning : failed to load external entity
"file:///c%3A/Test%C3%84%C3%96%C3%9C/sharpconstruct/interface/SharpConstruct.glade"

(sharpconstruct.exe:2268): libglade-WARNING **: document not well formed

The complicated file URI is meant to correspond to the filename
c:\TestÄÖÜ/sharpconstruct/interface/SharpConstruct.glade, but with the
umlauts converted to UTF-8 first, then URL-escaped. This looks
suspicious, because AFAIK URIs always use ISO Latin1 as encoding (they
had to invent IRIs in RFC3987 to fix this). The example error message
uses a test directory, the one that is really used in the app is
different (and dependant on the national variant of Windows).

Currently, the code in SharpConstruct does this:

a) Get the app data directory from Windows, via SHGetFolderPathA().
The result from this is a string represented as char*, encoded in
WINDOWS-1252.
b) Convert the result from a) to UTF-8 with g_convert(), and store as gchar*
c) Pass the result from b) to Glib::ustring constructor
d) Pass the result from c) to Gnome::Glade::Xml::create()
e) Failure

I though this was correct, but apparently it's not. What is the right
way to do this?

--
(defun f(p x)(If(Eq x nil)nil(If(p(Car x))(Cons(Car x)(f p(Cdr x)))(f p
(Cdr x)))))(defun q(x)(Q nil x))(defun Q(a x)(If(Eq x nil)a(Q(Cons(Car
x)(Q a(f(Lt(Car x))(Cdr x))))(f(Gt(Car x))(Cdr x)))))



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