diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-06-13 13:40:29 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2022-06-13 13:40:29 +0000 |
commit | d5a7bc26d70baba102295ca5f8120c7d1f223119 (patch) | |
tree | c5c7eeaf90f5e76d2effdd000295a3082c846558 /Build | |
parent | 4ba94250fa34e326153c3ca7211e9ef455402eb6 (diff) |
ptexenc: more strict check for UTF-8
git-svn-id: svn://tug.org/texlive/trunk@63574 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index e5f5e0f6cc4..db0a5e624d0 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -809,7 +809,7 @@ static int infile_enc[NOFILE]; /* ENC_UNKNOWN (=0): not determined /* 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 @@ char *ptenc_guess_enc(FILE *fp) 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 @@ char *ptenc_guess_enc(FILE *fp) 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'; |