about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2023-10-04 23:50:20 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2023-10-17 07:32:44 +0000
commitb0c270d7f89b80207e5cd514da2b0e5af54670e6 (patch)
tree944f152e6093d84488eea9559a7fb274615d2448
parent71036c5877fea5016554f5034333beb251bdb227 (diff)
downloadlynx-snapshots-b0c270d7f89b80207e5cd514da2b0e5af54670e6.tar.gz
snapshot of project "lynx", label v2-9-0dev_12h
-rw-r--r--CHANGES4
-rw-r--r--WWW/Library/Implementation/SGML.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index b39b1b79..2a217dca 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,11 @@
--- $LynxId: CHANGES,v 1.1140 2023/10/01 10:57:43 tom Exp $
+-- $LynxId: CHANGES,v 1.1141 2023/10/04 23:50:20 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
 2023-10-02 (2.9.0dev.13)
+* improve check for UTF-8 character encoding in XML Text Declaration (report by
+  Lennart Jablonka) -TD
 * fix for decoding utf-8 in CDATA sections (patch by Hiltjo Posthuma)
 * treat HTTP 308 permanently redirected the same as HTTP 301 permanently moved
   (Debian #1041686).
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index e2d15922..5bf8db97 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: SGML.c,v 1.184 2023/07/30 18:12:21 Hiltjo.Posthuma Exp $
+ * $LynxId: SGML.c,v 1.185 2023/10/04 23:42:42 tom Exp $
  *
  *			General SGML Parser code		SGML.c
  *			========================
@@ -902,10 +902,13 @@ static void handle_processing_instruction(HTStream *me)
 	    char *t = strstr(s, "encoding=");
 
 	    if (t != 0) {
+		char delim = 0;
+
 		t += 9;
-		if (*t == '"')
-		    ++t;
-		flag = !StrNCmp(t, "utf-8", 5);
+		if (*t == '"' || *t == '\'')
+		    delim = *t++;
+		flag = (!strncasecomp(t, "utf-8", 5) &&
+			(delim == 0 || t[5] == delim));
 	    }
 	    if (flag) {
 		CTRACE((tfp, "...Use UTF-8 for XML\n"));