diff options
author | erdgeist <> | 2008-06-11 22:29:42 +0000 |
---|---|---|
committer | erdgeist <> | 2008-06-11 22:29:42 +0000 |
commit | 1dc48307c7c102e0a259719ae5dbc4df4ca8e438 (patch) | |
tree | 3f91c5c8a69e3f88c0fef2bb14891981c6db02e3 | |
parent | b0f21fcf119ca1c54cdc3e37a1c61e29c58c2798 (diff) |
better test for list of encodings
-rw-r--r-- | encoding.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/encoding.js b/encoding.js index 2f0ad8c..d263fd1 100644 --- a/encoding.js +++ b/encoding.js | |||
@@ -5,10 +5,7 @@ function decode_charsets( str, encoding ) { | |||
5 | return decode_jis( str ); | 5 | return decode_jis( str ); |
6 | } | 6 | } |
7 | 7 | ||
8 | map = encodings[encoding]; | 8 | map = encodings[encoding] || enc_8859_1; |
9 | if( map == null ) { | ||
10 | map = enc_8859_1; | ||
11 | } | ||
12 | 9 | ||
13 | for( var i=0; i< str.length; ++i ) { | 10 | for( var i=0; i< str.length; ++i ) { |
14 | var append = str.charCodeAt(i) & 0xff; | 11 | var append = str.charCodeAt(i) & 0xff; |
@@ -132,4 +129,5 @@ var encodings = { | |||
132 | "ibm437":enc_CP437,"ibm737":enc_CP737,"ibm775":enc_CP775,"ibm850":enc_CP850,"ibm852":enc_CP852,"ibm855":enc_CP855,"ibm857":enc_CP857, | 129 | "ibm437":enc_CP437,"ibm737":enc_CP737,"ibm775":enc_CP775,"ibm850":enc_CP850,"ibm852":enc_CP852,"ibm855":enc_CP855,"ibm857":enc_CP857, |
133 | "ibm860":enc_CP860,"ibm861":enc_CP861,"ibm862":enc_CP862,"ibm863":enc_CP863,"ibm864":enc_CP864,"ibm865":enc_CP865,"ibm866":enc_CP866, | 130 | "ibm860":enc_CP860,"ibm861":enc_CP861,"ibm862":enc_CP862,"ibm863":enc_CP863,"ibm864":enc_CP864,"ibm865":enc_CP865,"ibm866":enc_CP866, |
134 | "cp869": enc_CP869,"cp-gr": enc_CP869,"ibm869":enc_CP869,"windows-874": enc_CP874,"cp874":enc_CP874,"ibm874":enc_CP874 | 131 | "cp869": enc_CP869,"cp-gr": enc_CP869,"ibm869":enc_CP869,"windows-874": enc_CP874,"cp874":enc_CP874,"ibm874":enc_CP874 |
135 | }; \ No newline at end of file | 132 | }; |
133 | |||