git: 9front

Download patch

ref: c95371953ad70559d21fe3492721e7bc8541b4f4
parent: 23b7e2b0fbbdc4751a2334bcb742b43f9a4a5530
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 13 19:47:24 EDT 2016

uhtml: dont trust charset=utf-8 attribute, verify.

when the charset is explicitely specified as utf-8, ignore it
for now. we'll assume utf-8 when all bytes have been properly
utf-8 encoded.

--- a/sys/src/cmd/uhtml.c
+++ b/sys/src/cmd/uhtml.c
@@ -122,7 +122,8 @@
 		}
 		t = *e;
 		*e = 0;
-		if((a = attr(g, "encoding")) != nil || (a = attr(g, "charset")) != nil){
+		if((a = attr(g, "encoding")) != nil || (a = attr(g, "charset")) != nil)
+		if(cistrcmp(a, "utf") != 0 && cistrcmp(a, "utf-8") != 0){
 			cset = a;
 			*e = t;
 			break;
--