ref: 5697e93e654d04b1f872a3af3418ea3c293b5883
parent: b821a768241d35d23f4f2abe4616f822cc9f3775
author: cinap_lenrek <[email protected]>
date: Mon Dec 31 17:49:29 EST 2012
unicode: use Runeerror
--- a/sys/src/cmd/unicode.c
+++ b/sys/src/cmd/unicode.c
@@ -85,9 +85,13 @@
q = *argv;
while(*q){
w = chartorune(&r, q);
- if(r==0x80 && (q[0]&0xFF)!=0x80){
- fprint(2, "unicode: invalid utf string %s\n", *argv);
- return "bad utf";
+ if(r==Runeerror){
+ char b[UTFmax];
+
+ if(runetochar(b, &r) != w || memcmp(b, q, w) != 0){
+ fprint(2, "unicode: invalid utf string %s\n", *argv);
+ return "bad utf";
+ }
}
Bprint(&bout, "%.4x\n", r);
q += w;