commit | 7f0d675d583a2f219e7a54e9e72671ef6b323c55 | [log] [tgz] |
---|---|---|
author | rsc <devnull@localhost> | Tue Sep 13 00:23:53 2005 +0000 |
committer | rsc <devnull@localhost> | Tue Sep 13 00:23:53 2005 +0000 |
tree | 4024c00d8685eaa13b22b1ef569318d769436f9c | |
parent | 58acc3d4427314035b00cb29e240570e87634f64 [diff] |
Fix UTF bug reported on 9fans.
diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c index d3fa939..bc7deb6 100644 --- a/src/cmd/tcs/utf.c +++ b/src/cmd/tcs/utf.c
@@ -39,15 +39,16 @@ tot += n; for(i=j=0; i<tot; ){ c = our_mbtowc(&l, buf+i, tot-i); - if(c == -1) + if(c == -2) break; - if(c == -2){ + if(c == -1){ if(squawk) EPR "%s: bad UTF sequence near byte %ld in input\n", argv0, ninput+i); if(clean) continue; nerrors++; l = Runeerror; + c = 1; } runes[j++] = l; i += c;