OSDN Git Service

Fix JIS X 0201 decode [nkf-bug#30162]
authorNARUSE, Yui <naruse@users.sourceforge.jp>
Thu, 22 Nov 2012 07:13:03 +0000 (16:13 +0900)
committerNARUSE, Yui <naruse@users.sourceforge.jp>
Thu, 22 Nov 2012 07:15:09 +0000 (16:15 +0900)
patched by deton.
http://sourceforge.jp/ticket/browse.php?group_id=248&tid=30162

nkf.c
nkf_test.pl

diff --git a/nkf.c b/nkf.c
index a16b142..89c4643 100644 (file)
--- a/nkf.c
+++ b/nkf.c
@@ -5683,6 +5683,7 @@ kanji_convert(FILE *f)
                    else if (c1 == 'I') {
                        /* JIS X 0201 Katakana */
                        set_input_mode(JIS_X_0201_1976_K);
+                       shift_mode = 1;
                        SKIP;
                    }
                    else if (c1 == 'B' || c1 == 'J' || c1 == 'H') {
index 79cfea6..7279cd2 100644 (file)
@@ -527,6 +527,17 @@ printf "%-40s", "X0201 output: EUC";
     &test("$nkf -xe",$example{'x0201.jis'},$example{'x0201.euc'});
 printf "%-40s", "X0201 output: UTF8";
     &test("$nkf -xw",$example{'x0201.jis'},$example{'x0201.utf'});
+# test_data/x0201jis=
+
+$example{'test_data/x0201jis=.ans'} = unpack('u',<<'eofeof');
+MH:*CI*6FIZBIJJNLK:ZOL+&RL[2UMK>XN;J[O+V^O\#!PL/$Q<;'R,G*R\S-
+2SL_0T=+3U-76U]C9VMO<W=[?
+eofeof
+
+printf "%-40s",  "X0201 JIS contains '='";
+    &test("$nkf -xs",
+    "\x1b(I!\"#\$%&'()*+,-./0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\x1b(B",
+    $example{'test_data/x0201jis=.ans'});
 
 # MIME decode