# HG changeset patch # User paulb # Date 1093976889 0 # Node ID dd031a30ecb5ff2bdeaba718d86ae9b7cde2ca9d # Parent 239a52be1330c5b425e23e51b558850a8e629354 [project @ 2004-08-31 18:28:09 by paulb] Fixed encoding usage in body fields processing. Removed the default charset from ContentType since it is not necessarily helpful. diff -r 239a52be1330 -r dd031a30ecb5 WebStack/BaseHTTPRequestHandler.py --- a/WebStack/BaseHTTPRequestHandler.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/BaseHTTPRequestHandler.py Tue Aug 31 18:28:09 2004 +0000 @@ -212,7 +212,7 @@ or a plain string (representing a file upload form field, for example). """ - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" if self.storage_body is None: self.storage_body = FieldStorage(fp=self.get_request_stream(), headers=self.get_headers(), diff -r 239a52be1330 -r dd031a30ecb5 WebStack/CGI.py --- a/WebStack/CGI.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/CGI.py Tue Aug 31 18:28:09 2004 +0000 @@ -206,7 +206,7 @@ or a plain string (representing a file upload form field, for example). """ - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" if self.storage_body is None: self.storage_body = FieldStorage(fp=self.get_request_stream(), keep_blank_values=1) diff -r 239a52be1330 -r dd031a30ecb5 WebStack/Generic.py --- a/WebStack/Generic.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/Generic.py Tue Aug 31 18:28:09 2004 +0000 @@ -23,13 +23,12 @@ """ Initialise the container with the given principal 'content_type', an - optional 'charset' (which otherwise uses "utf-8" as default), and - optional 'attributes' (a list of 2-tuples each representing the - key=value pairs which qualify content types). + optional 'charset', and optional 'attributes' (a list of 2-tuples each + representing the key=value pairs which qualify content types). """ self.content_type = content_type - self.charset = charset or "utf-8" + self.charset = charset self.attributes = attributes class Transaction: diff -r 239a52be1330 -r dd031a30ecb5 WebStack/ModPython.py --- a/WebStack/ModPython.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/ModPython.py Tue Aug 31 18:28:09 2004 +0000 @@ -170,7 +170,7 @@ body with fields found in the path. """ - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" if self.storage_body is None: self.storage_body = FieldStorage(self.trans, keep_blank_values=1) diff -r 239a52be1330 -r dd031a30ecb5 WebStack/Twisted.py --- a/WebStack/Twisted.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/Twisted.py Tue Aug 31 18:28:09 2004 +0000 @@ -161,7 +161,7 @@ or a plain string (representing a file upload form field, for example). """ - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" fields = {} for field_name, field_values in self.trans.args.items(): if type(field_values) == type([]): diff -r 239a52be1330 -r dd031a30ecb5 WebStack/Webware.py --- a/WebStack/Webware.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/Webware.py Tue Aug 31 18:28:09 2004 +0000 @@ -182,7 +182,7 @@ or a plain string (representing a file upload form field, for example). """ - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" fields = {} for field_name, field_values in self.trans.request().fields().items(): if type(field_values) == type([]): diff -r 239a52be1330 -r dd031a30ecb5 WebStack/Zope.py --- a/WebStack/Zope.py Mon Aug 30 18:24:17 2004 +0000 +++ b/WebStack/Zope.py Tue Aug 31 18:28:09 2004 +0000 @@ -184,7 +184,7 @@ # NOTE: Conversion to Unicode may be inappropriate. - encoding = self.get_content_type().charset or encoding or "iso-8859-1" + encoding = encoding or self.get_content_type().charset or "iso-8859-1" fields = {} for field_name, field_values in self.get_fields_from_path().items(): if type(field_values) == type([]):