ruby-changes:24916
From: naruse <ko1@a...>
Date: Sat, 15 Sep 2012 02:26:51 +0900 (JST)
Subject: [ruby-changes:24916] naruse:r36968 (trunk): * ext/nkf/nkf-utf8/nkf.c: Merge upstream: 50a383c84.
naruse 2012-09-15 02:26:39 +0900 (Sat, 15 Sep 2012) New Revision: 36968 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36968 Log: * ext/nkf/nkf-utf8/nkf.c: Merge upstream: 50a383c84. [ruby-dev:46128] [Bug #7005] Modified files: trunk/ChangeLog trunk/ext/nkf/nkf-utf8/nkf.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36967) +++ ChangeLog (revision 36968) @@ -1,3 +1,8 @@ +Sat Sep 15 01:56:40 2012 NARUSE, Yui <naruse@r...> + + * ext/nkf/nkf-utf8/nkf.c: Merge upstream: 50a383c84. + [ruby-dev:46128] [Bug #7005] + Sat Sep 15 00:20:04 2012 NARUSE, Yui <naruse@r...> * ext/nkf/nkf.c (rb_nkf_convert): suppress warning. Index: ext/nkf/nkf-utf8/nkf.c =================================================================== --- ext/nkf/nkf-utf8/nkf.c (revision 36967) +++ ext/nkf/nkf-utf8/nkf.c (revision 36968) @@ -20,11 +20,11 @@ * * 3. This notice may not be removed or altered from any source distribution. */ -#define NKF_VERSION "2.1.2" -#define NKF_RELEASE_DATE "2011-09-08" +#define NKF_VERSION "2.1.3" +#define NKF_RELEASE_DATE "2012-09-13" #define COPY_RIGHT \ "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \ - "Copyright (C) 1996-2011, The nkf Project." + "Copyright (C) 1996-2012, The nkf Project." #include "config.h" #include "nkf.h" @@ -356,6 +356,7 @@ /* ignore ZERO WIDTH NO-BREAK SPACE */ static int no_best_fit_chars_f = FALSE; static int input_endian = ENDIAN_BIG; +static int input_bom_f = FALSE; static nkf_char unicode_subchar = '?'; /* the regular substitution character */ static void (*encode_fallback)(nkf_char c) = NULL; static void w_status(struct input_code *, nkf_char); @@ -3202,6 +3203,7 @@ set_iconv(TRUE, w_iconv32); } if (iconv == w_iconv32) { + input_bom_f = TRUE; input_endian = ENDIAN_BIG; return; } @@ -3232,6 +3234,7 @@ set_iconv(TRUE, w_iconv); } if (iconv == w_iconv) { + input_bom_f = TRUE; return; } (*i_ungetc)(0xBF,f); @@ -3260,6 +3263,7 @@ } if (iconv == w_iconv16) { input_endian = ENDIAN_BIG; + input_bom_f = TRUE; return; } (*i_ungetc)(0xFF,f); @@ -3275,6 +3279,7 @@ } if (iconv == w_iconv32) { input_endian = ENDIAN_LITTLE; + input_bom_f = TRUE; return; } (*i_ungetc)(0x00,f); @@ -3286,6 +3291,7 @@ } if (iconv == w_iconv16) { input_endian = ENDIAN_LITTLE; + input_bom_f = TRUE; return; } (*i_ungetc)(0xFE,f); @@ -3494,7 +3500,7 @@ f_prev = c1; if (c2 || c2 == JIS_X_0201_1976_K) f_prev |= 0x80; /* this is Japanese */ - f_line += char_size(c2,c1); + f_line += c2 == JIS_X_0201_1976_K ? 1: char_size(c2,c1); if (f_line<=fold_len) { /* normal case */ fold_state = 1; } else { @@ -4190,8 +4196,13 @@ if (guess_f == 1) { printf("%s\n", input_codename); } else { - printf("%s%s\n", + printf("%s%s%s%s\n", input_codename, + iconv != w_iconv16 && iconv != w_iconv32 ? "" : + input_endian == ENDIAN_LITTLE ? " LE" : + input_endian == ENDIAN_BIG ? " BE" : + "[BUG]", + input_bom_f ? " (BOM)" : "", input_eol == CR ? " (CR)" : input_eol == LF ? " (LF)" : input_eol == CRLF ? " (CRLF)" : @@ -5480,7 +5491,7 @@ code_status(c1); if (c2) { /* second byte */ - if (c2 > DEL) { + if (c2 > ((input_encoding && nkf_enc_cp5022x_p(input_encoding)) ? 0x92 : DEL)) { /* in case of 8th bit is on */ if (!estab_f&&!mime_decode_mode) { /* in case of not established yet */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/