summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 }