diff options
author | rsc <devnull@localhost> | 2005-09-13 00:23:53 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-09-13 00:23:53 +0000 |
commit | 7f0d675d583a2f219e7a54e9e72671ef6b323c55 (patch) | |
tree | 4024c00d8685eaa13b22b1ef569318d769436f9c /src/cmd/tcs | |
parent | 58acc3d4427314035b00cb29e240570e87634f64 (diff) | |
download | plan9port-7f0d675d583a2f219e7a54e9e72671ef6b323c55.tar.gz plan9port-7f0d675d583a2f219e7a54e9e72671ef6b323c55.tar.bz2 plan9port-7f0d675d583a2f219e7a54e9e72671ef6b323c55.zip |
Fix UTF bug reported on 9fans.
Diffstat (limited to 'src/cmd/tcs')
-rw-r--r-- | src/cmd/tcs/utf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c index d3fa9398..bc7deb6e 100644 --- a/src/cmd/tcs/utf.c +++ b/src/cmd/tcs/utf.c @@ -39,15 +39,16 @@ utf_in(int fd, long *notused, struct convert *out) 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; |