isdigit((unsigned char)(*cp1)))
isdigit(UCH(*cp1)))
PUBLIC HTFormat HTCharsetFormat ARGS3(	HTFormat,		format,	HTParentAnchor *,	anchor,	int,			default_LYhndl){    char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4;    BOOL chartrans_ok = FALSE;    int chndl = -1;    FREE(anchor->charset);    StrAllocCopy(cp, format->name);    LYLowerCase(cp);    if (((cp1 = strchr(cp, ';')) != NULL) &&	(cp2 = strstr(cp1, "charset")) != NULL) {	CTRACE(tfp, "HTCharsetFormat: Extended MIME Content-Type is %s\n",		    format->name);	cp2 += 7;	while (*cp2 == ' ' || *cp2 == '=')	    cp2++;	StrAllocCopy(cp3, cp2); /* copy to mutilate more */	for (cp4 = cp3; (*cp4 != '\0' && *cp4 != '"' &&			 *cp4 != ';'  && *cp4 != ':' &&			 !WHITE(*cp4)); cp4++) {	    ; /* do nothing */	}	*cp4 = '\0';	cp4 = cp3;	chndl = UCGetLYhndl_byMIME(cp3);	if (UCCanTranslateFromTo(chndl, current_char_set)) {	    chartrans_ok = YES;	    *cp1 = '\0';	    format = HTAtom_for(cp);	    StrAllocCopy(anchor->charset, cp4);	    HTAnchor_setUCInfoStage(anchor, chndl,				    UCT_STAGE_MIME,				    UCT_SETBY_MIME);	} else if (chndl < 0) {	    /*	    **	Got something but we don't recognize it.	    */	    chndl = UCLYhndl_for_unrec;	    if (chndl < 0)	    /*	    **  UCLYhndl_for_unrec not defined :-(	    **  fallback to UCLYhndl_for_unspec which always valid.	    */	    chndl = UCLYhndl_for_unspec;  /* always >= 0 */	    if (UCCanTranslateFromTo(chndl, current_char_set)) {		chartrans_ok = YES;		HTAnchor_setUCInfoStage(anchor, chndl,					UCT_STAGE_MIME,					UCT_SETBY_DEFAULT);	    }	}	if (chartrans_ok) {	    LYUCcharset *p_in = HTAnchor_getUCInfoStage(anchor,							UCT_STAGE_MIME);	    LYUCcharset *p_out = HTAnchor_setUCInfoStage(anchor,							 current_char_set,							 UCT_STAGE_HTEXT,							 UCT_SETBY_DEFAULT);	    if (!p_out) {		/*		**  Try again.		*/		p_out = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT);	    }	    if (!strcmp(p_in->MIMEname, "x-transparent")) {		HTPassEightBitRaw = TRUE;		HTAnchor_setUCInfoStage(anchor,					HTAnchor_getUCLYhndl(anchor,							     UCT_STAGE_HTEXT),					UCT_STAGE_MIME,					UCT_SETBY_DEFAULT);	    }	    if (!strcmp(p_out->MIMEname, "x-transparent")) {		HTPassEightBitRaw = TRUE;		HTAnchor_setUCInfoStage(anchor,					HTAnchor_getUCLYhndl(anchor,							     UCT_STAGE_MIME),					UCT_STAGE_HTEXT,					UCT_SETBY_DEFAULT);	    }	    if (p_in->enc != UCT_ENC_CJK) {		HTCJK = NOCJK;		if (!(p_in->codepoints &		      UCT_CP_SUBSETOF_LAT1) &&		    chndl == current_char_set) {		    HTPassEightBitRaw = TRUE;		}	    } else if (p_out->enc == UCT_ENC_CJK) {		Set_HTCJK(p_in->MIMEname, p_out->MIMEname);	    }	} else {	    /*	    **  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.	    */	    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) {	/*	**  No charset parameter is present.	**  Ignore all other parameters, as	**  we do when charset is present. - FM	*/	*cp1 = '\0';	format = HTAtom_for(cp);    }    FREE(cp);    /*    **	Set up defaults, if needed. - FM    */    if (!chartrans_ok && !anchor->charset && default_LYhndl >= 0) {	HTAnchor_setUCInfoStage(anchor, default_LYhndl,				UCT_STAGE_MIME,				UCT_SETBY_DEFAULT);    }    HTAnchor_copyUCInfoStage(anchor,			    UCT_STAGE_PARSER,			    UCT_STAGE_MIME,			    -1);    return format;}