[Phoenix-commits] rev 20561 - public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content

andi at wyona.com andi at wyona.com
Mon Dec 4 19:11:25 CET 2006


Author: andi
Date: 2006-12-04 19:11:23 +0100 (Mon, 04 Dec 2006)
New Revision: 20561

Modified:
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/networkservice.js
Log:
Use a constant to define the default char set.


Modified: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/networkservice.js
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/networkservice.js	2006-12-04 17:22:34 UTC (rev 20560)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/networkservice.js	2006-12-04 18:11:23 UTC (rev 20561)
@@ -32,6 +32,9 @@
 // see WWW-Authenticate at http://www.ietf.org/rfc/rfc2617.txt and Authorization at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
 const SUPPORTED_AUTHENTICATION_SCHEMES =  "Neutron-Auth";
 
+// the default character set to fall back to if none is specified (note that the HTTP/1.1 specification requires this to be ISO-8859-1)
+const DEFAULT_CHAR_SET = "UTF-8";
+
 var NetworkService = {
     /**
      * Perform a file download over HTTP.
@@ -845,12 +848,12 @@
                 charSet = aRequest.QueryInterface(Components.interfaces.nsIChannel).contentCharset;
 
                 if (!charSet || charSet == "")
-                    charSet = "UTF-8";
+                    charSet = DEFAULT_CHAR_SET;
             } catch (exception) {
-                // failed to retrieve content character set; fall back to UTF-8
-                /* DEBUG */ dump("Yulup:networkservice.js:YulupNetworkStreamListener.onStopRequest: failed to retrieve document character set. Falling back to UTF-8.\n");
+                // failed to retrieve content character set; fall back to DEFAULT_CHAR_SET
+                /* DEBUG */ dump("Yulup:networkservice.js:YulupNetworkStreamListener.onStopRequest: failed to retrieve document character set. Falling back to " + DEFAULT_CHAR_SET + ".\n");
                 /* DEBUG */ YulupDebug.dumpExceptionToConsole("Yulup:networkservice.js:YulupNetworkStreamListener.onStopRequest", exception);
-                charSet = "UTF-8";
+                charSet = DEFAULT_CHAR_SET;
             }
 
             try {




More information about the Phoenix-commits mailing list