From 88b848edfbddd42ebf2be54d3615c35402606726 Mon Sep 17 00:00:00 2001 From: NARUSE Yui Date: Thu, 19 Nov 2009 20:50:14 +0900 Subject: [PATCH] Fix: MIME encode ISO-2022-JP after US-ASCII is broken. [ruby-dev:39722] --- nkf.c | 9 ++++++--- nkf_test.pl | 12 ++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/nkf.c b/nkf.c index 9e52ce3..9bda6e2 100644 --- a/nkf.c +++ b/nkf.c @@ -4849,10 +4849,13 @@ mime_putc(nkf_char c) return; } } - (*o_mputc)(c); - base64_count++; + if (c != 0x1B) { + (*o_mputc)(c); + base64_count++; + return; + } } - return; + else return; } if (mimeout_mode <= 0) { diff --git a/nkf_test.pl b/nkf_test.pl index 7780677..5a7a5cb 100644 --- a/nkf_test.pl +++ b/nkf_test.pl @@ -428,10 +428,10 @@ printf "%-40s", "Microsoft UCS Mapping :"; printf "%-40s", "CP932 to UTF-16BE :"; &test("$nkf --ic=cp932 --oc=utf-16be",$example{'ms_ucs_map_1_sjis'},$example{'ms_ucs_map_1_utf16_ms'}); -# X0201 $B2>L>(B +# X0201 仮名 # X0201->X0208 conversion # X0208 aphabet -> ASCII -# X0201 $BAj8_JQ49(B +# X0201 相互変換 print "\nX0201 test\n\n"; @@ -1004,6 +1004,14 @@ eofeof printf "%-40s", "test_data/bugs10904"; &test("$nkf -Mj",$example{'test_data/bugs10904'},$example{'test_data/bugs10904.ans'}); +printf "%-40s", "test_data/ruby-dev:39722"; + &test("$nkf -Mj",<