Michael Radziej wrote:
> Gábor Farkas:
>> Michael Radziej wrote:
>>>    * What encoding does python use if you pass unicode to open()?
>> for os.listdir it uses sys.getfilesystemencoding(), so i assume it does 
>> the same for open().
>>
>> so usually it does the correct thing.
>>
>> so using unicode filenames are probably fine, but then we are again back 
>> at the to-unicodify-or-not-to-unicodify-django question :)
> 
> No, I'd propose simply to use the file system's encoding for files
> within the file system, that's all, if there's no compelling reason
> to use punycode. There's no connection to "unicode everywhere".
> 

well, maybe not a "direct" connection.

but, if i understand correctly, you propose it to behave like:


=============================
filename1 = 
request.POST.somehow_get_the_filename_i_do_not_want_to_look_it_up_right_now()

# let's pray that the user's html templates
# are encoded using settings.DEFAULT_CHARSET

filename2 = filename1.decode(settings.DEFAULT_CHARSET)

filename3 = filename2.encode(sys.getfilesystemencoding())

f = open(filename3)
=============================

which for me seems like a hack..., because:

1. we do not mandate yet that GET/POST data is in settings.DEFAULT_CHARSET

2. generally playing these encode/decode games is not nice :)

but i agree, that doing this would probably solve a lot of cases.

gabor

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to