From 83258625a9f176cfabf39f63d3d4deeec3212c73 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 13 Jun 2008 14:27:08 +0000 Subject: Dont want to fail badly when utf-8 encoding is claimed but not there. --- encoding.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ) { var outstring = outchars.join( '' ); if( encoding == "utf8" || encoding == "utf-8" ) { - return decodeURIComponent( escape( outstring ) ); + try { + return decodeURIComponent( escape( outstring ) ); + } catch( err ) { + return outstring; + } } else if ( encoding == "ibm864" ) { return outstring.replace( "%", String.fromCharCode( 0x66a ) ); } -- cgit v1.2.3