couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r791145 - in /couchdb/trunk: share/server/render.js share/www/script/test/list_views.js share/www/script/test/show_documents.js src/couchdb/couch_httpd_external.erl
Date Sat, 04 Jul 2009 16:19:23 GMT
Author: jchris
Date: Sat Jul  4 16:19:23 2009
New Revision: 791145

URL: http://svn.apache.org/viewvc?rev=791145&view=rev
Log:
send utf-8 hearders with list and show responses. closes COUCHDB-392

Modified:
    couchdb/trunk/share/server/render.js
    couchdb/trunk/share/www/script/test/list_views.js
    couchdb/trunk/share/www/script/test/show_documents.js
    couchdb/trunk/src/couchdb/couch_httpd_external.erl

Modified: couchdb/trunk/share/server/render.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/render.js?rev=791145&r1=791144&r2=791145&view=diff
==============================================================================
--- couchdb/trunk/share/server/render.js (original)
+++ couchdb/trunk/share/server/render.js Sat Jul  4 16:19:23 2009
@@ -166,8 +166,8 @@
 // http://dev.rubyonrails.org/svn/rails/trunk/actionpack/lib/action_controller/mime_types.rb
 
 registerType("all", "*/*");
-registerType("text", "text/plain", "txt");
-registerType("html", "text/html");
+registerType("text", "text/plain; charset=utf-8", "txt");
+registerType("html", "text/html; charset=utf-8");
 registerType("xhtml", "application/xhtml+xml", "xhtml");
 registerType("xml", "application/xml", "text/xml", "application/x-xml");
 registerType("js", "text/javascript", "application/javascript", "application/x-javascript");

Modified: couchdb/trunk/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/list_views.js?rev=791145&r1=791144&r2=791145&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/list_views.js (original)
+++ couchdb/trunk/share/www/script/test/list_views.js Sat Jul  4 16:19:23 2009
@@ -312,7 +312,7 @@
       "Accept": 'text/html'
     }
   });
-  T(xhr.getResponseHeader("Content-Type") == "text/html");
+  T(xhr.getResponseHeader("Content-Type") == "text/html; charset=utf-8");
   T(xhr.responseText.match(/HTML/));
   T(xhr.responseText.match(/Value/));
 

Modified: couchdb/trunk/share/www/script/test/show_documents.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/show_documents.js?rev=791145&r1=791144&r2=791145&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/show_documents.js (original)
+++ couchdb/trunk/share/www/script/test/show_documents.js Sat Jul  4 16:19:23 2009
@@ -143,10 +143,7 @@
   // hello template world
   xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/"+docid);
   T(xhr.responseText == "Hello World");
-// 
-// };
-// 
-// function foo() {
+  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
 
   // Fix for COUCHDB-379
   T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
@@ -207,7 +204,8 @@
   xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/accept-switch/"+docid,
{
     headers: {"Accept": "text/html;text/plain;*/*"}
   });
-  T("text/html" == xhr.getResponseHeader("Content-Type"));
+  var ct = xhr.getResponseHeader("Content-Type");
+  T(/text\/html/.test(ct))
   T("Accept" == xhr.getResponseHeader("Vary"));
   var etag = xhr.getResponseHeader("etag");
 
@@ -287,7 +285,9 @@
       "Accept": 'text/html,application/atom+xml; q=0.9'
     }
   });
-  T(xhr.getResponseHeader("Content-Type") == "text/html");
+  var ct = xhr.getResponseHeader("Content-Type");
+  T(/charset=utf-8/.test(ct))
+  T(/text\/html/.test(ct))  
   T(xhr.responseText == "Ha ha, you said \"plankton\".");
 
   // now with xml
@@ -315,7 +315,9 @@
      "Accept": 'text/html,application/atom+xml; q=0.9'
    }
   });
-  T(xhr.getResponseHeader("Content-Type") == "text/html");
+  var ct = xhr.getResponseHeader("Content-Type");
+  T(/charset=utf-8/.test(ct))
+  T(/text\/html/.test(ct))
   T(xhr.responseText == "Ha ha, you said \"plankton\".");
 
   // test inclusion of conflict state

Modified: couchdb/trunk/src/couchdb/couch_httpd_external.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_external.erl?rev=791145&r1=791144&r2=791145&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_external.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_external.erl Sat Jul  4 16:19:23 2009
@@ -117,7 +117,7 @@
                     data=?JSON_ENCODE(Value),
                     ctype="application/json"};
             {<<"body">>, Value} ->
-                Args#extern_resp_args{data=Value, ctype="text/html"};
+                Args#extern_resp_args{data=Value, ctype="text/html; charset=utf-8"};
             {<<"base64">>, Value} ->
                 Args#extern_resp_args{
                     data=couch_util:decodeBase64(Value),        



Mime
View raw message