Re: [xml] Default Catalog On Windows, Deprecated API



On 14.06.2004 20:25, Mark_Vakoc peoplesoft com wrote:

I don't know how much that matters -- down the road libxml2 uses the C API
(fopen. etc) which takes a const char* and does not support UTF-8 encoded
filenames anyways, at least not the ms runtime, so even if you used the
wide version of GetModuleFileNameW and converted it to UTF-8 the end result
is that the C file apis would fail anywyas.  The only place that would
benefit from that are custum i/o handlers that may properly use UTF-8
encoded paths.

It was a crazy thought, yes.

In fact, functions which accept any strings other than Unicode don't really exist in the NT incarnation of Windows. They all convert their parameters to Unicode (UTF-16LE) and then call their Unicode-enabled sisters to do the actual work.

Thes means, every program which doesn't use the native Unicode API has a penalty of one string conversion and one function call whenever it calls an API function which accepts or returns a string.

So is fopen. Its implementation ends up calling the native API CreateFileA and that one will convert the file name to Unicode and call CreateFileW. Or, perhaps fopen will convert the file name and call wfopen. The source will tell which is the case, but it doesn't matter. In every case the conversion is done using the current locale and if you had an UTF-8 locale...

But again, it was a crazy thought. Windows doesn't have UTF-8 in any locale anyway. :-) I don't know why, perhaps because UTF-8 is Unicode after all.

Ciao,
Igor



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