2009/7/23 Nimrod A. Abing <nimrod.ab...@gmail.com>:
>
> On Wed, Jul 22, 2009 at 8:17 PM, Graham
> Dumpleton<graham.dumple...@gmail.com> wrote:
>>
>> 2009/7/22 Nimrod A. Abing <nimrod.ab...@gmail.com>:
>>>
>>> 2009/7/22 Graham Dumpleton <graham.dumple...@gmail.com>:
>>>>
>>>> 2009/7/22 Mike Plavsky <supermapl...@gmail.com>:
>>>>>
>>>>> Was using mod_wsgi 2.3, checked with mod_wsgi 2.5 and Python 2.6.1 -
>>>>> the result is the same. So yes, probably the issue is Windows
>>>>> specific. BTW do you test mod_wsgi on Windows?
>>>>
>>>> I have only recently starting compiling mod_wsgi on Windows myself.
>>>> About all I do is a hello world test. Bulk of recent changes are to
>>>> daemon mode and so aren't relevant to Windows.
>>>>
>>>> At a guess, I would say that the problem is that I am using plain old
>>>> fopen(). Apache on the other hand uses apr_file_open() which on
>>>> Windows does some madness with converting path from UTF-8 to Unicode
>>>> and then using CreateFileW().
>>>>
>>>> The problem is that PyParser_SimpleParseFile(), as used by mod_wsgi,
>>>> in Python expects a FILE pointer. I am not sure I can get a FILE
>>>> pointer out of the native OS file handle that would be created by
>>>> apr_file_open()/CreateFileW() on Windows.
>>>>
>>>> The question is, if one passed UTF-8 string file filename to fopen()
>>>> on Windows, what happens? Should I be converting the UTF-8 string to
>>>> Unicode and using _wfopen() instead?
>>>>
>>>> The APR library has a semi private function utf8_to_unicode_path()
>>>> which they use for doing this, but is there an official Window
>>>> function that can use to convert UTF-8 string to wide string for
>>>> _wfopen().
>>>>
>>>> Anyone with Windows programming knowledge who can advise what should be 
>>>> done?
>>>>
>>>
>>> _wfopen() and fopen() are deprecated Win32 CRT functions. Use
>>> _wfopen_s() and fopen_s() instead. As for converting between UTF-8 and
>>> wchar_t it needs a bit of strong arming to get it done and normally
>>> you would just use iconv for it but there is a lightweight library for
>>> doing just that: http://www.bsdua.org/libbsdua.html#utf8
>>
>> How about mbstowcs(). That is what I already use for a few things for
>> Python 3.X support.
>
> That should work too and is locale aware, but that's also deprecated.
> Use mbstowcs_s instead. I think for string functions you are
> recommended to use the *_s versions now. I posted the other
> lightweight utf8 conversion lib because I was considering portability.

Only need it on Windows and even though deprecated, isn't going to go
away. Python itself internally uses these functions still as well.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modwsgi@googlegroups.com
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to