  This patch is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  and to alter it and redistribute it freely.

diff -ur lynx2-8-5/WWW/Library/Implementation/HTAAUtil.c lynx2-8-5-bj/WWW/Library/Implementation/HTAAUtil.c
--- lynx2-8-5/WWW/Library/Implementation/HTAAUtil.c	2002-10-07 02:43:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTAAUtil.c	2003-09-21 13:52:43.000000000 +0200
@@ -43,6 +43,7 @@
 **
 */
 
+#include <LYUtils.h>
 #include <HTUtils.h>
 
 #include <HTAAUtil.h>	/* Implemented here	*/
@@ -281,7 +282,7 @@
     int m;
 
     /* Find first mismatch */
-    for (; *p  &&  *q  &&  TOUPPER(*p) == TOUPPER(*q); p++, q++)
+    for (; *p  &&  *q  &&  ascii_toupper(*p) == ascii_toupper(*q); p++, q++)
 	; /* do nothing else */
 
     if (!*p && !*q)
diff -ur lynx2-8-5/WWW/Library/Implementation/HTAnchor.c lynx2-8-5-bj/WWW/Library/Implementation/HTAnchor.c
--- lynx2-8-5/WWW/Library/Implementation/HTAnchor.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTAnchor.c	2003-09-21 13:54:15.000000000 +0200
@@ -15,6 +15,7 @@
 
 #define HASH_SIZE 101		/* Arbitrary prime.  Memory/speed tradeoff */
 
+#include <LYUtils.h>
 #include <HTUtils.h>
 #include <HTAnchor.h>
 #include <HTParse.h>
@@ -34,7 +35,7 @@
  *		much simpler function than the original used.
  */
 #define HASH_FUNCTION(cp_address) ((unsigned short int)strlen(cp_address) *\
-	(unsigned short int)TOUPPER(*cp_address) % HASH_SIZE)
+	(unsigned short int)ascii_toupper(*cp_address) % HASH_SIZE)
 #endif /* NOT_DEFINED */
 /*
  *	This is the original function.	We'll use it again. - FM
@@ -129,7 +130,7 @@
 
 #ifdef CASE_INSENSITIVE_ANCHORS
 /* Case insensitive string comparison */
-#define HT_EQUIV(a,b) (TOUPPER(a) == TOUPPER(b))
+#define HT_EQUIV(a,b) (ascii_toupper(a) == ascii_toupper(b))
 #else
 /* Case sensitive string comparison */
 #define HT_EQUIV(a,b) ((a) == (b))
diff -ur lynx2-8-5/WWW/Library/Implementation/HTFTP.c lynx2-8-5-bj/WWW/Library/Implementation/HTFTP.c
--- lynx2-8-5/WWW/Library/Implementation/HTFTP.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTFTP.c	2003-09-21 14:01:25.000000000 +0200
@@ -58,6 +58,7 @@
 */
 
 #include <HTUtils.h>
+#include <LYUtils.h>
 
 #include <HTAlert.h>
 
@@ -236,7 +237,7 @@
 	CONST char *q;
 	for (p = hostname, q = nn;
 	     *p && *p != '.' && *q && *q != '.'; p++, q++){
-	    if (TOUPPER(*p) != TOUPPER(*q)) {
+	    if (ascii_toupper(*p) != ascii_toupper(*q)) {
 		char *r;
 		strcpy(nodename, nn);
 		r = strchr(nodename, '.');	/* Mismatch */
@@ -1725,8 +1726,8 @@
 	isalpha(UCH(*(cpd+1))) && *(cpd+4) == '-') {
 
 	/** Month **/
-	*(cpd+2) = (char) TOLOWER(*(cpd+2));
-	*(cpd+3) = (char) TOLOWER(*(cpd+3));
+	*(cpd+2) = (char) ascii_tolower(*(cpd+2));
+	*(cpd+3) = (char) ascii_tolower(*(cpd+3));
 	sprintf(date, "%.3s ", cpd+1);
 
 	/** Day **/
@@ -2229,7 +2230,7 @@
 	    /*
 	    **	Check first character of ls -l output.
 	    */
-	    if (TOUPPER(entry[0]) == 'D')  {
+	    if (ascii_toupper(entry[0]) == 'D')  {
 		/*
 		**  It's a directory.
 		*/
@@ -2644,9 +2645,9 @@
 	}
 	if ((cp = strrchr(lastpath, ';')) != NULL) {   /* Trim type= param. */
 	    if (!strncasecomp((cp+1), "type=", 5)) {
-		if (TOUPPER(*(cp+6)) == 'D' ||
-		    TOUPPER(*(cp+6)) == 'A' ||
-		    TOUPPER(*(cp+6)) == 'I')
+		if (ascii_toupper(*(cp+6)) == 'D' ||
+		    ascii_toupper(*(cp+6)) == 'A' ||
+		    ascii_toupper(*(cp+6)) == 'I')
 		    *cp = '\0';
 	    }
 	}
@@ -3106,7 +3107,7 @@
 	if (server_type == CMS_SERVER) {
 	    /** If the unescaped path has a %2f, reject it as illegal. - FM **/
 	    if (((cp = strstr(filename, "%2")) != NULL) &&
-		TOUPPER(cp[2]) == 'F') {
+		ascii_toupper(cp[2]) == 'F') {
 		FREE(fname);
 		init_help_message_cache();  /* to free memory */
 		NETCLOSE(control->socket);
@@ -3124,7 +3125,7 @@
 	    **	Check and trim the type= parameter. - FM
 	    */
 	    if (!strncasecomp((type+1), "type=", 5)) {
-		switch(TOUPPER(*(type+6))) {
+		switch(ascii_toupper(*(type+6))) {
 		case 'D':
 		    *type = '\0';
 		    type = "D";
diff -ur lynx2-8-5/WWW/Library/Implementation/HTFile.c lynx2-8-5-bj/WWW/Library/Implementation/HTFile.c
--- lynx2-8-5/WWW/Library/Implementation/HTFile.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTFile.c	2003-09-21 13:58:33.000000000 +0200
@@ -20,6 +20,7 @@
 **			the device or top directory.
 */
 
+#include <LYUtils.h>
 #include <HTUtils.h>
 
 #ifndef VMS
@@ -1311,7 +1312,7 @@
 	if (((len = strlen(escaped)) > 2) &&
 	    escaped[(len - 3)] == '%' &&
 	    escaped[(len - 2)] == '2' &&
-	    TOUPPER(escaped[(len - 1)]) == 'F') {
+	    ascii_toupper(escaped[(len - 1)]) == 'F') {
 	    escaped[(len - 3)] = '\0';
 	}
     }
@@ -1390,9 +1391,9 @@
     */
     if ((cp = strrchr(path, ';')) != NULL) {
 	if (!strncasecomp((cp+1), "type=", 5)) {
-	    if (TOUPPER(*(cp+6)) == 'D' ||
-		TOUPPER(*(cp+6)) == 'A' ||
-		TOUPPER(*(cp+6)) == 'I')
+	    if (ascii_toupper(*(cp+6)) == 'D' ||
+		ascii_toupper(*(cp+6)) == 'A' ||
+		ascii_toupper(*(cp+6)) == 'I')
 		*cp = '\0';
 	}
 	cp = NULL;
diff -ur lynx2-8-5/WWW/Library/Implementation/HTMIME.c lynx2-8-5-bj/WWW/Library/Implementation/HTMIME.c
--- lynx2-8-5/WWW/Library/Implementation/HTMIME.c	2003-01-22 10:43:13.000000000 +0100
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTMIME.c	2003-09-21 13:44:31.000000000 +0200
@@ -756,7 +756,7 @@
 	*/
 	for (i = 0, j = 0; me->value[i]; i++) {
 	    if (me->value[i] != ' ' && me->value[i] != '\"') {
-		me->value[j++] = (char) TOLOWER(me->value[i]);
+		me->value[j++] = (char) ascii_tolower(me->value[i]);
 	    }
 	}
 	me->value[j] = '\0';
@@ -1597,7 +1597,7 @@
 	break;
 
     case miCHECK:			/* Check against string */
-	if (TOLOWER(c) == *(me->check_pointer)++) {
+	if (ascii_tolower(c) == *(me->check_pointer)++) {
 	    if (!*me->check_pointer)
 		me->state = me->if_ok;
 	} else {		/* Error */
diff -ur lynx2-8-5/WWW/Library/Implementation/HTNews.c lynx2-8-5-bj/WWW/Library/Implementation/HTNews.c
--- lynx2-8-5/WWW/Library/Implementation/HTNews.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTNews.c	2003-09-21 13:59:42.000000000 +0200
@@ -7,6 +7,7 @@
 */
 
 #include <HTUtils.h>		/* Coding convention macros */
+#include <LYUtils.h>
 
 #ifndef DISABLE_NEWS
 
@@ -309,7 +310,7 @@
 {
     CONST char * u = unknown;
     CONST char * t = template;
-    for (; *u && *t && (TOUPPER(*u) == *t); u++, t++)
+    for (; *u && *t && (ascii_toupper(*u) == *t); u++, t++)
 	; /* Find mismatch or end */
     return (BOOL)(*t == 0);		/* OK if end of template */
 }
diff -ur lynx2-8-5/WWW/Library/Implementation/HTString.c lynx2-8-5-bj/WWW/Library/Implementation/HTString.c
--- lynx2-8-5/WWW/Library/Implementation/HTString.c	2003-04-28 02:38:00.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTString.c	2003-09-21 13:46:44.000000000 +0200
@@ -10,6 +10,7 @@
 
 #include <HTUtils.h>
 
+#include <LYUtils.h>
 #include <LYLeaks.h>
 #include <LYStrings.h>
 
@@ -167,7 +168,7 @@
     CONST char *q = b;
 
     for ( ; *p && *q; p++, q++) {
-	int diff = TOLOWER(*p) - TOLOWER(*q);
+	int diff = ascii_tolower(*p) - ascii_tolower(*q);
 	if (diff) return diff;
     }
     if (*p)
@@ -195,7 +196,7 @@
 	    return 0;	/*   Match up to n characters */
 	if (!(*p && *q))
 	    return (*p - *q);
-	diff = TOLOWER(*p) - TOLOWER(*q);
+	diff = ascii_tolower(*p) - ascii_tolower(*q);
 	if (diff)
 	    return diff;
     }
@@ -219,8 +220,8 @@
     for ( ; ; p++, q++) {
 	if (!(*p && *q))
 	    return (UCH(*p)  - UCH(*q));
-	diff = TOASCII(TOLOWER(*p))
-	     - TOASCII(TOLOWER(*q));
+	diff = TOASCII(ascii_tolower(*p))
+	     - TOASCII(ascii_tolower(*q));
 	if (diff)
 	    return diff;
     }
diff -ur lynx2-8-5/WWW/Library/Implementation/SGML.c lynx2-8-5-bj/WWW/Library/Implementation/SGML.c
--- lynx2-8-5/WWW/Library/Implementation/SGML.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/SGML.c	2003-09-21 13:56:54.000000000 +0200
@@ -9,6 +9,7 @@
 **	 6 Feb 93  Binary searches used. Interface modified.
 */
 
+#include <LYUtils.h>
 #include <HTUtils.h>
 
 /* Remove the following to disable the experimental HTML DTD parsing.
@@ -61,9 +62,9 @@
 #endif
 
 /* my_casecomp() - optimized by the first character, NOT_ASCII ok */
-#define my_casecomp(a,b)  ((TOUPPER(*a) == TOUPPER(*b)) ? \
+#define my_casecomp(a,b)  ((ascii_toupper(*a) == ascii_toupper(*b)) ? \
 			AS_casecomp(a,b) : \
-			(TOASCII(TOUPPER(*a)) - TOASCII(TOUPPER(*b))))
+			(TOASCII(ascii_toupper(*a)) - TOASCII(ascii_toupper(*b))))
 
  /* will use partially inlined version */
 #define orig_HTChunkPutUtf8Char HTChunkPutUtf8Char
@@ -2224,7 +2225,7 @@
 	 */
 	testlast = string->size - 2 - context->trailing_spaces - context->leading_spaces;
 
-	if (TOUPPER(c) != ((testlast < 0)
+	if (ascii_toupper(c) != ((testlast < 0)
 			    ? '/'
 			    : testtag->name[testlast])) {
 	    int i;
@@ -2425,7 +2426,7 @@
     **	Check for a numeric entity.
     */
     case S_cro:
+	if (TOASCII(unsign_c) < 127 && ascii_tolower(UCH(c)) == 'x') {  /* S/390 -- gil -- 1060 */
-	if (TOASCII(unsign_c) < 127 && TOLOWER(UCH(c)) == 'x') {  /* S/390 -- gil -- 1060 */
 	    context->isHex = TRUE;
 	    context->state = S_incro;
 	} else if (TOASCII(unsign_c) < 127 && isdigit(UCH(c))) {
diff -ur lynx2-8-5/src/GridText.c lynx2-8-5-bj/src/GridText.c
--- lynx2-8-5/src/GridText.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/GridText.c	2003-09-24 02:34:03.000000000 +0200
@@ -4399,10 +4399,10 @@
 				       (kanji_code != NOKANJI) ?
 							    ch :
 					  (font & HT_CAPITALS) ?
-						   TOUPPER(ch) : ch);
+						   ascii_toupper(ch) : ch);
 	} else {
 	    line->data[line->size++] =	/* Put character into line */
-		(char) (font & HT_CAPITALS ? TOUPPER(ch) : ch);
+		(char) (font & HT_CAPITALS ? ascii_toupper(ch) : ch);
 	}
 	line->data[line->size] = '\0';
 	if (font & HT_DOUBLE)		/* Do again if doubled */
diff -ur lynx2-8-5/src/HTAlert.c lynx2-8-5-bj/src/HTAlert.c
--- lynx2-8-5/src/HTAlert.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/HTAlert.c	2003-09-17 01:49:51.000000000 +0200
@@ -392,7 +392,7 @@
     int result = -1;
 
     /* If they're not really distinct in the first letter, revert to English */
-    if (TOUPPER(*msg_yes) == TOUPPER(*msg_no)) {
+    if (ascii_toupper(*msg_yes) == ascii_toupper(*msg_no)) {
 	msg_yes = "yes";
 	msg_no = "no";
     }
@@ -431,12 +431,12 @@
 #ifdef VMS
 	    if (HadVMSInterrupt) {
 		HadVMSInterrupt = FALSE;
-		c = TOUPPER(*msg_no);
+		c = ascii_toupper(*msg_no);
 	    }
 #endif /* VMS */
-	    if (c == TOUPPER(*msg_yes)) {
+	    if (c == ascii_toupper(*msg_yes)) {
 		result = YES;
-	    } else if (c == TOUPPER(*msg_no)) {
+	    } else if (c == ascii_toupper(*msg_no)) {
 		result = NO;
 	    } else if (fallback_y && c == fallback_y) {
 		result = YES;
@@ -858,7 +858,7 @@
 
 		    CTRACE((tfp, "Looking for %c in %s\n", ch, p));
 		    while (*p != R_PAREN && *p != 0 && isalpha(UCH(*s))) {
-			if (isalpha(UCH(*p)) && (*p == TOUPPER(*p))) {
+			if (isalpha(UCH(*p)) && (*p == ascii_toupper(*p))) {
 			    CTRACE((tfp, "...testing %c/%c\n", *p, *s));
 			    if (*p == ch) {
 				ch = *s;
diff -ur lynx2-8-5/src/HTML.c lynx2-8-5-bj/src/HTML.c
--- lynx2-8-5/src/HTML.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/HTML.c	2003-09-16 04:41:31.000000000 +0200
@@ -150,7 +150,7 @@
 PUBLIC void strtolower ARGS1(char*, i)
 {
     if (!i) return;
-    while (*i) { *i=(char)tolower(*i); i++; }
+    while (*i) { *i=(char)ascii_tolower(*i); i++; }
 }
 
 /*		Flattening the style structure
diff -ur lynx2-8-5/src/LYBookmark.c lynx2-8-5-bj/src/LYBookmark.c
--- lynx2-8-5/src/LYBookmark.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYBookmark.c	2003-09-17 01:50:08.000000000 +0200
@@ -34,7 +34,7 @@
 
 PUBLIC int LYMBM2index ARGS1(int, ch)
 {
-    if ((ch = TOUPPER(ch)) > 0) {
+    if ((ch = ascii_toupper(ch)) > 0) {
 	char *letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 	char *result = strchr(letters, ch);
 	if (result != 0
diff -ur lynx2-8-5/src/LYHash.c lynx2-8-5-bj/src/LYHash.c
--- lynx2-8-5/src/LYHash.c	2001-02-13 02:33:21.000000000 +0100
+++ lynx2-8-5-bj/src/LYHash.c	2003-09-16 04:43:21.000000000 +0200
@@ -30,7 +30,7 @@
     CONST char *p;
 
     for (p = string, hash = 0; *p; p++)
-	hash = HASH_OF(hash,tolower(*p));
+	hash = HASH_OF(hash,ascii_tolower(*p));
 
     return hash;
 }
@@ -46,7 +46,7 @@
     CONST char *p;
 
     for (p = string, hash = hash_was ; *p; p++)
-	hash = HASH_OF(hash,tolower(*p));
+	hash = HASH_OF(hash,ascii_tolower(*p));
 
     return hash;
 }
diff -ur lynx2-8-5/src/LYPrint.c lynx2-8-5-bj/src/LYPrint.c
--- lynx2-8-5/src/LYPrint.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYPrint.c	2003-09-17 01:53:01.000000000 +0200
@@ -379,7 +379,7 @@
 	}
     } else
 #endif
-    if ((outfile_fp = (TOUPPER(c) == 'A'
+    if ((outfile_fp = (ascii_toupper(c) == 'A'
 	    ? LYAppendToTxtFile(buffer)
 	    : LYNewTxtFile(buffer))) == NULL) {
 	CTRACE((tfp, "LYPrint: errno is %d\n", errno));
diff -ur lynx2-8-5/src/LYReadCFG.c lynx2-8-5-bj/src/LYReadCFG.c
--- lynx2-8-5/src/LYReadCFG.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYReadCFG.c	2003-09-17 01:52:29.000000000 +0200
@@ -1556,12 +1557,12 @@
 	char *,		name)
 {
     Config_Type *tbl = Config_Table;
-    char ch = (char) TOUPPER(*name);
+    char ch = (char) ascii_toupper(*name);
 
     while (tbl->name != 0) {
 	char ch1 = tbl->name[0];
 
-	if ((ch == TOUPPER(ch1))
+	if ((ch == ascii_toupper(ch1))
 	    && (0 == strcasecomp (name, tbl->name)))
 	    break;
 
diff -ur lynx2-8-5/src/LYStrings.c lynx2-8-5-bj/src/LYStrings.c
--- lynx2-8-5/src/LYStrings.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYStrings.c	2003-09-17 01:49:10.000000000 +0200
@@ -2377,7 +2377,7 @@
     if (ch == LYCharINTERRUPT1)
 	ch = LYCharINTERRUPT2;			/* treat ^C the same as ^G */
     else if (ch > 0 && ch < 256)
-	ch = TOUPPER(ch);	/* will ignore case of result */
+	ch = ascii_toupper(ch);	/* will ignore case of result */
     return ch;
 }
 
@@ -2399,11 +2399,11 @@
 	    }
 	    i++;
 	} else {
-	    buffer[i] = UCH(TOLOWER(buffer[i]));
+	    buffer[i] = UCH(ascii_tolower(buffer[i]));
 	}
     }
 #else
-	buffer[i] = TOLOWER(buffer[i]);
+	buffer[i] = ascii_tolower(buffer[i]);
 #endif
 }
 
@@ -2425,11 +2425,11 @@
 	    }
 	    i++;
 	} else {
-	    buffer[i] = UCH(TOUPPER(buffer[i]));
+	    buffer[i] = UCH(ascii_toupper(buffer[i]));
 	}
     }
 #else
-	buffer[i] = UCH(TOUPPER(buffer[i]));
+	buffer[i] = UCH(ascii_toupper(buffer[i]));
 #endif
 }
 
@@ -5516,11 +5516,11 @@
 
 /*
 **   UPPER8 ?
-**   it was "TOUPPER(a) - TOUPPER(b)" in its previous life...
+**   it was "ascii_toupper(a) - ascii_toupper(b)" in its previous life...
 **
 **   It was realized that case-insensitive user search
-**   got information about upper/lower mapping from TOUPPER
-**   (precisely from "(TOUPPER(a) - TOUPPER(b))==0")
+**   got information about upper/lower mapping from ascii_toupper
+**   (precisely from "(ascii_toupper(a) - ascii_toupper(b))==0")
 **   and depends on locale in its 8bit mapping. -
 **   Usually fails with DOS/WINDOWS display charsets
 **   as well as on non-UNIX systems.
@@ -5539,14 +5539,14 @@
 
     /* case-insensitive match for us-ascii */
     if (UCH(TOASCII(ch1)) < 128 && UCH(TOASCII(ch2)) < 128)
-	return(TOUPPER(ch1) - TOUPPER(ch2));
+	return(ascii_toupper(ch1) - ascii_toupper(ch2));
 
     /* case-insensitive match for upper half */
     if (UCH(TOASCII(ch1)) > 127 &&  /* S/390 -- gil -- 2066 */
 	UCH(TOASCII(ch2)) > 127)
     {
 	if (DisplayCharsetMatchLocale)
-	   return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */
+	   return(ascii_toupper(ch1) - ascii_toupper(ch2)); /* old-style */
 	else
 	{
 	    long uni_ch2 = UCTransToUni((char)ch2, current_char_set);
diff -ur lynx2-8-5/src/LYUtils.c lynx2-8-5-bj/src/LYUtils.c
--- lynx2-8-5/src/LYUtils.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYUtils.c	2003-09-20 01:12:46.000000000 +0200
@@ -189,6 +189,33 @@
     char *result = getenv(name);
     return non_empty(result) ? result : 0;
 }
+
+/*
+ * ascii versions of locale sensitive functions needed because in
+ * Turkish locales tolower("I") is not "i". That's fatal for case
+ * sensitive operations with charset names, HTML tags etc.
+ */
+PUBLIC int ascii_tolower ARGS1(int, i)
+{
+    if ( 91 > i && i > 64 )
+	return (i+32);
+    else
+	return i;
+}
+PUBLIC int ascii_toupper ARGS1(int, i)
+{
+    if ( 123 > i && i > 96 )
+	return (i-32);
+    else
+	return i;
+}
+PUBLIC int ascii_isupper ARGS1(int, i)
+{
+    if ( 91 > i && i > 64 )
+	return 1;
+    else
+	return 0;
+}
 
 /*
  * Check for UTF-8 data, returning the length past the first character.
@@ -2306,7 +2320,7 @@
 			if (strlen(cp) >= 11
 			 && (cp1 = strchr(cp+11,'/')) != NULL) {
 
-			    if (TOUPPER(*(cp1+1)) == 'H' || *(cp1+1) == 'w')
+			    if (ascii_toupper(*(cp1+1)) == 'H' || *(cp1+1) == 'w')
 				/* if this is a gopher html type */
 				result = HTML_GOPHER_URL_TYPE;
 			    else if (*(cp1+1) == 'T' || *(cp1+1) == '8')
@@ -3099,12 +3113,12 @@
      */
     j = strlen(fname) - 1;
     if ((dot = strrchr(fname, '.')) != NULL) {
-	if (TOUPPER(fname[j]) == 'Z') {
+	if (ascii_toupper(fname[j]) == 'Z') {
 	    if ((fname[j-1] == '.') &&
 		(((cp = strchr(fname, '.')) != NULL) && cp < dot)) {
 		*dot = '_';
 		dot = strrchr(fname, '.');
-	    } else if (((TOUPPER(fname[j-1]) == 'G') &&
+	    } else if (((ascii_toupper(fname[j-1]) == 'G') &&
 			fname[j-2] == '.') &&
 		       (((cp = strchr(fname, '.')) != NULL) && cp < dot)) {
 		*dot = '-';
@@ -5389,7 +5403,7 @@
 	(s - start) > (isdigit(UCH(*(s - 1))) ? 2 : 9))
 	return(0);
     LYstrncpy(temp, start, (isdigit(UCH(*(s - 1))) ? 2 : 3));
-    switch (TOUPPER(temp[0])) {
+    switch (ascii_toupper(temp[0])) {
 	case '0':
 	case '1':
 	    month = atoi(temp);
diff -ur lynx2-8-5/src/LYUtils.h lynx2-8-5-bj/src/LYUtils.h
--- lynx2-8-5/src/LYUtils.h	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYUtils.h	2003-09-20 01:33:46.000000000 +0200
@@ -129,6 +129,9 @@
 extern FILE *LYOpenTemp PARAMS((char *result, CONST char *suffix, CONST char *mode));
 extern FILE *LYOpenTempRewrite PARAMS((char *result, CONST char *suffix, CONST char *mode));
 extern FILE *LYReopenTemp PARAMS((char *name));
+extern int ascii_tolower PARAMS((int i));
+extern int ascii_toupper PARAMS((int i));
+extern int isupper PARAMS((int i));
 extern char *Current_Dir PARAMS((char * pathname));
 extern char *LYGetEnv PARAMS((CONST char * name));
 extern char *LYGetHiliteStr PARAMS(( int cur, int count));
diff -ur lynx2-8-5/src/LYrcFile.c lynx2-8-5-bj/src/LYrcFile.c
--- lynx2-8-5/src/LYrcFile.c	2003-06-02 03:16:28.000000000 +0200
+++ lynx2-8-5-bj/src/LYrcFile.c	2003-09-25 04:38:34.000000000 +0200
@@ -564,13 +587,13 @@
 	char *,		name)
 {
     Config_Type *tbl = Config_Table;
-    char ch = (char) TOUPPER(*name);
+    char ch = (char) ascii_toupper(*name);
 
     while (tbl->name != 0) {
 	if (tbl->enabled) {
 	    char ch1 = tbl->name[0];
 
-	    if ((ch == TOUPPER(ch1))
+	    if ((ch == ascii_toupper(ch1))
 		&& (0 == strcasecomp (name, tbl->name)))
 		break;
 	}
diff -ur lynx2-8-5/src/chrtrans/makeuctb.c lynx2-8-5-bj/src/chrtrans/makeuctb.c
--- lynx2-8-5/src/chrtrans/makeuctb.c	2000-10-25 18:35:28.000000000 +0200
+++ lynx2-8-5-bj/src/chrtrans/makeuctb.c	2003-09-20 03:31:51.000000000 +0200
@@ -25,14 +26,6 @@
 #undef exit
 #endif /* exit */
 
-#ifndef TOUPPER
-#define TOUPPER(c) (islower(UCH(c)) ? toupper(UCH(c)) : (c))
-#endif /* !TOLOWER */
-
-#ifndef TOLOWER
-#define TOLOWER(c) (isupper(UCH(c)) ? tolower(UCH(c)) : (c))
-#endif /* !TOLOWER */
-
 #include <UCkd.h>
 #include <UCDefs.h>
 
@@ -94,7 +87,7 @@
 	    return 0;	/*   Match up to n characters */
 	if (!(*p && *q))
 	    return (*p - *q);
-	diff = TOLOWER(*p) - TOLOWER(*q);
+	diff = ascii_tolower(*p) - ascii_tolower(*q);
 	if (diff)
 	    return diff;
     }
@@ -141,6 +134,14 @@
 
 #define MAX_UNIPAIRS 2500
 
+PRIVATE int ascii_tolower ARGS1(int, i)
+{
+    if( 91 > i && i > 64 )
+        return (i+32);
+    else 
+        return i;
+}
+
 PRIVATE void addpair_str ARGS2(
 	char *,		str,
 	int,		un)
@@ -417,7 +418,7 @@
 		while (*p == ' ' || *p == '\t') {
 		    p++;
 		}
-		this_isDefaultMap = (*p == '1' || TOLOWER(*p) == 'y');
+		this_isDefaultMap = (*p == '1' || ascii_tolower(*p) == 'y');
 		continue;
 
 	    /*
@@ -434,7 +435,7 @@
 		while (*p == ' ' || *p == '\t') {
 		    p++;
 		}
-		useDefaultMap = (*p == '1' || tolower(*p) == 'y');
+		useDefaultMap = (*p == '1' || ascii_tolower(*p) == 'y');
 		continue;
 
 	    case 'M':
@@ -735,7 +736,7 @@
 	}
     }
     for (p = this_MIMEcharset; *p; p++) {
-	*p = TOLOWER(*p);
+	*p = ascii_tolower(*p);
     }
     if (argc > 4) {
 	strncpy(this_LYNXcharset,argv[4],UC_MAXLEN_LYNXCSNAME);
--- lynx2-8-5/src/LYStrings.h	2003-04-28 02:38:00.000000000 +0200
+++ lynx2-8-5-bj/src/LYStrings.h	2003-09-26 04:45:02.000000000 +0200
@@ -12,7 +12,7 @@
 
 #define is8bits(ch) (UCH(ch) >= 128)	/* isascii(ch) is not POSIX */
 
-/*  UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2))  */
+/*  UPPER8(ch1,ch2) is an extension of (ascii_toupper(ch1) - ascii_toupper(ch2))  */
 extern int UPPER8  PARAMS((
 	int		ch1,
 	int		ch2));
--- lynx2-8-5/WWW/Library/Implementation/HTUtils.h	2003-09-26 05:08:38.000000000 +0200
+++ lynx2-8-5-bj/WWW/Library/Implementation/HTUtils.h	2003-09-26 05:09:00.000000000 +0200
@@ -486,12 +486,6 @@
 #include <ctype.h>
 #include <string.h>
 
-#ifndef TOLOWER
-  /* Pyramid and Mips can't uppercase non-alpha */
-#define TOLOWER(c) (isupper(UCH(c)) ? tolower(UCH(c)) : UCH(c))
-#define TOUPPER(c) (islower(UCH(c)) ? toupper(UCH(c)) : UCH(c))
-#endif /* TOLOWER */
-
 #define FREE(x)    {if (x != 0) {free((char *)x); x = NULL;}}
 
 /*
--- lynx2-8-5/src/LYExtern.c	2003-04-28 02:38:00.000000000 +0200
+++ lynx2-8-5-bj/src/LYExtern.c	2003-09-26 05:50:58.000000000 +0200
@@ -149,7 +149,7 @@
 	    /* Less ==> short filename with backslashes,
 	     * less ==> long filename with forward slashes, may be quoted
 	     */
-	    if (isupper(command[0])) {
+	    if (ascii_isupper(command[0])) {
 		format(&cmdbuf,
 			command, HTDOS_short_name(e_buff));
 	    } else {
