OSDN Git Service

Fix: guess encoding of 4bytes UTF-8 is broken. [nkf-forum#43436]
authorNARUSE, Yui <naruse@users.sourceforge.jp>
Sun, 26 Apr 2009 10:28:49 +0000 (19:28 +0900)
committerNARUSE, Yui <naruse@users.sourceforge.jp>
Sun, 26 Apr 2009 10:28:49 +0000 (19:28 +0900)
nkf.c

diff --git a/nkf.c b/nkf.c
index 7a7ebf0..5aa8842 100644 (file)
--- a/nkf.c
+++ b/nkf.c
@@ -3131,18 +3131,16 @@ h_conv(FILE *f, int c1, int c2)
            } else if ((c3 = (*i_getc)(f)) == EOF) {
                ret = EOF;
                break;
-           } else {
-               code_status(c3);
-               if (hold_index < hold_count){
-                   c4 = hold_buf[hold_index++];
-               } else if ((c4 = (*i_getc)(f)) == EOF) {
-                   c3 = ret = EOF;
-                   break;
-               } else {
-                   code_status(c4);
-                   (*iconv)(c1, c2, (c3<<8)|c4);
-               }
            }
+           code_status(c3);
+           if (hold_index < hold_count){
+               c4 = hold_buf[hold_index++];
+           } else if ((c4 = (*i_getc)(f)) == EOF) {
+               c3 = ret = EOF;
+               break;
+           }
+           code_status(c4);
+           (*iconv)(c1, c2, (c3<<8)|c4);
            break;
        case -1:
            /* 3 bytes EUC or UTF-8 */