]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/unicode.c
fix filetype detecton by suffix so that multiple dots dont confuse it. (thanks kvik)
[plan9front.git] / sys / src / cmd / unicode.c
index aec44b75005e57862fb5e82257ddafe69421addc..2d944c42e47afbb9ef914bfa33c0443f6229644d 100644 (file)
@@ -85,9 +85,13 @@ nums(char *argv[])
                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;