mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
Fix UTF bug reported on 9fans.
This commit is contained in:
parent
58acc3d442
commit
7f0d675d58
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue