UnicodeDecodeError with Django's request.FILES

后端 未结 4 1529
轻奢々
轻奢々 2021-02-09 04:41

I have the following code in the view call..

def view(request):
    body = u\"\"  
    for filename, f in request.FILES.items():
        body = body + \'Filename         


        
4条回答
  •  执念已碎
    2021-02-09 05:01

    If you are not in control of the file encoding for files that can be uploaded , you can guess what encoding a file is in using the Universal Encoding Detector module chardet.

提交回复
热议问题