1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/nkf/nkf-utf8/nkf.c: Refix [nkf-bug:21393]. (explicit -X)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-04-14 01:55:17 +00:00
parent 4392ea3527
commit b2ae252976
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,7 @@
Wed Apr 14 09:24:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: Refix [nkf-bug:21393]. (explicit -X)
Tue Apr 13 20:36:50 2010 NARUSE, Yui <naruse@ruby-lang.org> Tue Apr 13 20:36:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: Fix: Windows Codepages wrongly convert * ext/nkf/nkf-utf8/nkf.c: Fix: Windows Codepages wrongly convert

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA). * Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
* Copyright (c) 1996-2009, The nkf Project. * Copyright (c) 1996-2010, The nkf Project.
* *
* This software is provided 'as-is', without any express or implied * This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages * warranty. In no event will the authors be held liable for any damages
@ -21,7 +21,7 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
*/ */
#define NKF_VERSION "2.1.1" #define NKF_VERSION "2.1.1"
#define NKF_RELEASE_DATE "2010-04-13" #define NKF_RELEASE_DATE "2010-04-14"
#define COPY_RIGHT \ #define COPY_RIGHT \
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \ "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
"Copyright (C) 1996-2010, The nkf Project." "Copyright (C) 1996-2010, The nkf Project."
@ -382,6 +382,8 @@ static unsigned char stdibuf[IOBUF_SIZE];
static unsigned char stdobuf[IOBUF_SIZE]; static unsigned char stdobuf[IOBUF_SIZE];
#endif #endif
#define NKF_UNSPECIFIED (-TRUE)
/* flags */ /* flags */
static int unbuf_f = FALSE; static int unbuf_f = FALSE;
static int estab_f = FALSE; static int estab_f = FALSE;
@ -396,7 +398,7 @@ static int mimebuf_f = FALSE; /* MIME buffered input */
static int broken_f = FALSE; /* convert ESC-less broken JIS */ static int broken_f = FALSE; /* convert ESC-less broken JIS */
static int iso8859_f = FALSE; /* ISO8859 through */ static int iso8859_f = FALSE; /* ISO8859 through */
static int mimeout_f = FALSE; /* base64 mode */ static int mimeout_f = FALSE; /* base64 mode */
static int x0201_f = X0201_DEFAULT; /* convert JIS X 0201 */ static int x0201_f = NKF_UNSPECIFIED; /* convert JIS X 0201 */
static int iso2022jp_f = FALSE; /* replace non ISO-2022-JP with GETA */ static int iso2022jp_f = FALSE; /* replace non ISO-2022-JP with GETA */
#ifdef UNICODE_NORMALIZATION #ifdef UNICODE_NORMALIZATION
@ -1209,7 +1211,7 @@ set_input_encoding(nkf_encoding *enc)
case CP50220: case CP50220:
case CP50221: case CP50221:
case CP50222: case CP50222:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
cp51932_f = TRUE; cp51932_f = TRUE;
#endif #endif
@ -1231,7 +1233,7 @@ set_input_encoding(nkf_encoding *enc)
case SHIFT_JIS: case SHIFT_JIS:
break; break;
case WINDOWS_31J: case WINDOWS_31J:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
cp51932_f = TRUE; cp51932_f = TRUE;
#endif #endif
@ -1253,7 +1255,7 @@ set_input_encoding(nkf_encoding *enc)
case EUCJP_NKF: case EUCJP_NKF:
break; break;
case CP51932: case CP51932:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
cp51932_f = TRUE; cp51932_f = TRUE;
#endif #endif
@ -1324,7 +1326,7 @@ set_output_encoding(nkf_encoding *enc)
{ {
switch (nkf_enc_to_index(enc)) { switch (nkf_enc_to_index(enc)) {
case CP50220: case CP50220:
x0201_f = TRUE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
if (cp932inv_f == TRUE) cp932inv_f = FALSE; if (cp932inv_f == TRUE) cp932inv_f = FALSE;
#endif #endif
@ -1333,7 +1335,7 @@ set_output_encoding(nkf_encoding *enc)
#endif #endif
break; break;
case CP50221: case CP50221:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
if (cp932inv_f == TRUE) cp932inv_f = FALSE; if (cp932inv_f == TRUE) cp932inv_f = FALSE;
#endif #endif
@ -1362,7 +1364,7 @@ set_output_encoding(nkf_encoding *enc)
case SHIFT_JIS: case SHIFT_JIS:
break; break;
case WINDOWS_31J: case WINDOWS_31J:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef UTF8_OUTPUT_ENABLE #ifdef UTF8_OUTPUT_ENABLE
ms_ucs_map_f = UCS_MAP_CP932; ms_ucs_map_f = UCS_MAP_CP932;
#endif #endif
@ -1391,7 +1393,7 @@ set_output_encoding(nkf_encoding *enc)
#endif #endif
break; break;
case CP51932: case CP51932:
x0201_f = FALSE; if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */
#ifdef SHIFTJIS_CP932 #ifdef SHIFTJIS_CP932
if (cp932inv_f == TRUE) cp932inv_f = FALSE; if (cp932inv_f == TRUE) cp932inv_f = FALSE;
#endif #endif
@ -5188,7 +5190,7 @@ reinit(void)
broken_f = FALSE; broken_f = FALSE;
iso8859_f = FALSE; iso8859_f = FALSE;
mimeout_f = FALSE; mimeout_f = FALSE;
x0201_f = X0201_DEFAULT; x0201_f = NKF_UNSPECIFIED;
iso2022jp_f = FALSE; iso2022jp_f = FALSE;
#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE) #if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
ms_ucs_map_f = UCS_MAP_ASCII; ms_ucs_map_f = UCS_MAP_ASCII;
@ -5301,6 +5303,10 @@ module_connection(void)
if (nkf_enc_unicode_p(output_encoding)) if (nkf_enc_unicode_p(output_encoding))
output_mode = UTF_8; output_mode = UTF_8;
if (x0201_f == NKF_UNSPECIFIED) {
x0201_f = X0201_DEFAULT;
}
/* replace continucation module, from output side */ /* replace continucation module, from output side */
/* output redicrection */ /* output redicrection */