From 3bd0646c6c2b60d55b7a22a67cec51a98de8a06e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 10 Nov 2019 11:42:49 +0000 Subject: [PATCH] utf8 encoding --- content.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content.py b/content.py index 1f5976a8d..d269dbfd0 100644 --- a/content.py +++ b/content.py @@ -396,7 +396,7 @@ def extractMediaInFormPOST(postBytes,boundary,name: str): """Extracts the binary encoding for image/video/audio within a http form POST Returns the media bytes and the remaining bytes """ - imageStartBoundary=b'Content-Disposition: form-data; name="'+unicode(name,"utf-8")+b'";' + imageStartBoundary=b'Content-Disposition: form-data; name="'+name.encode('utf8', 'ignore')+b'";' imageStartLocation=postBytes.find(imageStartBoundary) if imageStartLocation==-1: return None,postBytes @@ -447,7 +447,7 @@ def saveMediaInFormPOST(mediaBytes,baseDir: str, \ 'ogg': 'audio/ogg' } for extension,contentType in extensionList.items(): - searchStr=b'Content-Type: '+unicode(contentType,'utf-8') + searchStr=b'Content-Type: '+contentType.encode('utf8', 'ignore') mediaLocation=mediaBytes.find(searchStr) if not filenameBase: filenameBase= \