﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6009	UnicodeDecodeError when uploading file with non-english filename.	bear330	Leah Culver	"Upload a file using newforms I will get a UploadedFile object which contains filename and content for uploaded file.

If I upload a file with english file name ('abcd.jpg'), everything is right.
But if not (for example: ''''中文.jpg'''', when I assign the UploadedFile object's filename to ImageField or FileField in a model and save it, I will get a UnicodeDecodeError.

This is because the '''django.http.parse_file_upload will treat filename as 'str' object not 'unicode' object.''' 

I must do this manually to avoid this bug:

'''filename = uploadedFileObj.filename.decode('utf8')'''

After that, UnicodeDecodeError will not happen again, but the FileField's value in database will be '.jpg'.

OH! terrible! That is because the django.utils.text.get_valid_filename do this:

'''re.sub(r'[^-A-Za-z0-9_.]', '', s)'''

'''This will be good in english file name, but not in other languages.
After the re.sub, '中文.jpg' => u'\u4e2d\u6587.jpg' will be u'.jpg'.'''

For me, this is very serious problem.
At this time, I can fix that by doing decode('utf8') and override get_valid_filename manually.
But I hope this bug will be fixed by django officially.

Thanks for your effort. :)"		closed	Internationalization	dev		fixed	files, unicode, FileBackend fs-rf		Ready for checkin	1	0	0	0	0	0
