summaryrefslogtreecommitdiff
path: root/ext/nkf/nkf-utf8
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-05 07:53:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-05 07:53:14 +0000
commit1ff45719130e7224b07e9625963248f9c408bdd7 (patch)
tree4bb4726d161667a36660cbde4d3f715c188878af /ext/nkf/nkf-utf8
parenta09556f064195cefc088d18320797598c2a99ebb (diff)
* ext/nkf/nkf-utf8/nkf.c: follow nkf 1.65
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/nkf-utf8')
-rw-r--r--ext/nkf/nkf-utf8/nkf.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c
index 128e28e762..f3470136e7 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -41,7 +41,7 @@
***********************************************************************/
/* $Id$ */
#define NKF_VERSION "2.0.4"
-#define NKF_RELEASE_DATE "2005-03-04"
+#define NKF_RELEASE_DATE "2005-03-05"
#include "config.h"
static char *CopyRight =
@@ -743,6 +743,9 @@ main(argc, argv)
} else {
int nfiles = argc;
while (argc--) {
+ is_inputcode_mixed = FALSE;
+ is_inputcode_set = FALSE;
+ input_codename = "";
if ((fin = fopen((origfname = *argv++), "r")) == NULL) {
perror(*--argv);
return(-1);
@@ -1884,6 +1887,7 @@ kanji_convert(f)
{
int c1,
c2, c3;
+ int is_8bit = FALSE;
module_connection();
c2 = 0;
@@ -1948,6 +1952,7 @@ kanji_convert(f)
/* 8 bit code */
if (!estab_f && !iso8859_f) {
/* not established yet */
+ if (!is_8bit) is_8bit = TRUE;
c2 = c1;
NEXT;
} else { /* estab_f==TRUE */
@@ -2198,12 +2203,17 @@ kanji_convert(f)
/* epilogue */
(*iconv)(EOF, 0, 0);
if (!is_inputcode_set)
- set_input_codename(
- iconv == e_iconv ? "EUC-JP" :
- iconv == s_iconv ? "Shift_JIS" :
- iconv == w_iconv ? "UTF-8" :
- iconv == w_iconv16 ? "UTF-16" :
- "ASCII");
+ {
+ if (is_8bit) {
+ struct input_code *p = input_code_list;
+ struct input_code *result = p;
+ while (p->name){
+ if (p->score < result->score) result = p;
+ ++p;
+ }
+ set_input_codename(result->name);
+ }
+ }
return 1;
}