texlive[63574] Build/source/texk/ptexenc/ptexenc.c: ptexenc: more

commits+takuji at tug.org commits+takuji at tug.org
Mon Jun 13 15:40:29 CEST 2022


Revision: 63574
          http://tug.org/svn/texlive?view=revision&revision=63574
Author:   takuji
Date:     2022-06-13 15:40:29 +0200 (Mon, 13 Jun 2022)
Log Message:
-----------
ptexenc: more strict check for UTF-8

Modified Paths:
--------------
    trunk/Build/source/texk/ptexenc/ptexenc.c

Modified: trunk/Build/source/texk/ptexenc/ptexenc.c
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc.c	2022-06-13 02:55:10 UTC (rev 63573)
+++ trunk/Build/source/texk/ptexenc/ptexenc.c	2022-06-13 13:40:29 UTC (rev 63574)
@@ -809,7 +809,7 @@
 
 /* guess file encoding */
 /*
-    asumption:
+    assumption:
       No halfwidth katakana in Shift_JIS
       No SS2 nor SS3 in EUC-JP
       JIS X 0208 only and no platform dependent characters in Shift_JIS, EUC-JP
@@ -930,8 +930,7 @@
                 continue;
             }
             cu8[pos_utf8] = k0;
-            pos_utf8++;
-            if (pos_utf8==len_utf8) {
+            if (pos_utf8==1) {
                 if ((cu8[0]==0xE0 && cu8[1]<0xA0) ||
                     (cu8[0]==0xED && cu8[1]>0x9F) ||
                     (cu8[0]==0xF0 && cu8[1]<0x90)) { /* illegal combination in UTF-8 */
@@ -939,6 +938,9 @@
                     pos_utf8 = 0;
                     continue;
                 }
+            }
+            pos_utf8++;
+            if (pos_utf8==len_utf8) {
 #ifdef DEBUG
                 for (i=0; i<len_utf8; i++) str0[i] = cu8[i];
                 str0[i] = '\0';



More information about the tex-live-commits mailing list.