summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2008-06-13 14:27:08 +0000
committererdgeist <>2008-06-13 14:27:08 +0000
commit83258625a9f176cfabf39f63d3d4deeec3212c73 (patch)
tree5dc749956e67a3ab5135a36e18e61378c116aa56
parent0f6ea219a43423c470a9a7919d5f35c390061a28 (diff)
Dont want to fail badly when utf-8 encoding is claimed but not there.
-rw-r--r--encoding.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/encoding.js b/encoding.js
index 263ca88..1370eb7 100644
--- a/encoding.js
+++ b/encoding.js
@@ -19,7 +19,11 @@ function decode_charsets( str, encoding ) {
19 var outstring = outchars.join( '' ); 19 var outstring = outchars.join( '' );
20 20
21 if( encoding == "utf8" || encoding == "utf-8" ) { 21 if( encoding == "utf8" || encoding == "utf-8" ) {
22 return decodeURIComponent( escape( outstring ) ); 22 try {
23 return decodeURIComponent( escape( outstring ) );
24 } catch( err ) {
25 return outstring;
26 }
23 } else if ( encoding == "ibm864" ) { 27 } else if ( encoding == "ibm864" ) {
24 return outstring.replace( "%", String.fromCharCode( 0x66a ) ); 28 return outstring.replace( "%", String.fromCharCode( 0x66a ) );
25 } 29 }