about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTFile.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1999-01-18 12:35:47 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1999-01-18 12:35:47 -0500
commitd97a65137382daf2f896a947ba680c095f7ab664 (patch)
tree6db3daec0d5c2f909ba586adff0ddc2ad96d84d9 /WWW/Library/Implementation/HTFile.c
parenta2e9461739dd215db90a5cee2c22a74e5f57d151 (diff)
downloadlynx-snapshots-d97a65137382daf2f896a947ba680c095f7ab664.tar.gz
snapshot of project "lynx", label v2-8-2dev_14
Diffstat (limited to 'WWW/Library/Implementation/HTFile.c')
-rw-r--r--WWW/Library/Implementation/HTFile.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index f20d744e..c4826feb 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -933,18 +933,44 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
 	    }
 	} else {
 	    /*
-	    **	Hope it's a match, for now. - FM
+	    **  Cannot translate.
+	    **  If according to some heuristic the given
+	    **  charset and the current display character
+	    **  both are likely to be like ISO-8859 in
+	    **  structure, pretend we have some kind
+	    **  of match.
 	    */
-	    *cp1 = '\0';
-	    format = HTAtom_for(cp);
-	    cp1 = &cp4[10];
-	    while (*cp1 &&
-		   isdigit((unsigned char)(*cp1)))
-		cp1++;
-	    *cp1 = '\0';
-	    StrAllocCopy(anchor->charset, cp4);
-	    HTPassEightBitRaw = TRUE;
-	    HTAlert(anchor->charset);
+	    BOOL given_is_8859
+		= (!strncmp(cp4, "iso-8859-", 9) &&
+		   isdigit((unsigned char)cp4[9]));
+	    BOOL given_is_8859like
+		= (given_is_8859 ||
+		   !strncmp(cp4, "windows-", 8) ||
+		   !strncmp(cp4, "cp12", 4) ||
+		   !strncmp(cp4, "cp-12", 5));
+	    BOOL given_and_display_8859like
+		= (given_is_8859like &&
+		   (strstr(LYchar_set_names[current_char_set],
+			   "ISO-8859") ||
+		    strstr(LYchar_set_names[current_char_set],
+			   "windows-")));
+
+	    if (given_and_display_8859like) {
+		*cp1 = '\0';
+		format = HTAtom_for(cp);
+	    }
+	    if (given_is_8859) {
+		cp1 = &cp4[10];
+		while (*cp1 &&
+		       isdigit((unsigned char)(*cp1)))
+		    cp1++;
+		*cp1 = '\0';
+	    }
+	    if (given_and_display_8859like) {
+		StrAllocCopy(anchor->charset, cp4);
+		HTPassEightBitRaw = TRUE;
+	    }
+	    HTAlert(*cp4 ? cp4 : anchor->charset);
 	}
 	FREE(cp3);
     } else if (cp1 != NULL) {