fixed bug 510:

helma.Http did not handle character encoding correctly
This commit is contained in:
michi 2007-05-03 11:09:05 +00:00
parent 3548d309c1
commit 0aa1a868d1

View file

@ -10,8 +10,8 @@
* *
* $RCSfile: Http.js,v $ * $RCSfile: Http.js,v $
* $Author: robert $ * $Author: robert $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2007/01/30 14:55:39 $ * $Date: 2007/04/23 12:10:07 $
*/ */
@ -469,8 +469,13 @@ helma.Http = function() {
if (binaryMode) { if (binaryMode) {
result.content = body.toByteArray(); result.content = body.toByteArray();
} else { } else {
result.content = result.encoding ? var charset;
body.toString(result.encoding) : if (result.type && result.type.indexOf("charset=") != -1) {
charset = result.type.substring(result.type.indexOf("charset=") + 8);
charset = charset.replace('"', ' ').trim();
}
result.content = charset ?
body.toString(charset) :
body.toString(); body.toString();
} }
result.length = result.content.length; result.length = result.content.length;