tFix UTF bug reported on 9fans. - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 7f0d675d583a2f219e7a54e9e72671ef6b323c55 | |
parent 58acc3d4427314035b00cb29e240570e87634f64 | |
Author: rsc <devnull@localhost> | |
Date: Tue, 13 Sep 2005 00:23:53 +0000 | |
Fix UTF bug reported on 9fans. | |
Diffstat: | |
M src/cmd/tcs/utf.c | 5 +++-- | |
1 file changed, 3 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c | |
t@@ -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 %l… | |
if(clean) | |
continue; | |
nerrors++; | |
l = Runeerror; | |
+ c = 1; | |
} | |
runes[j++] = l; | |
i += c; |