case 0x00AD: r = "-"; break;
pa_map_escape(char *buf, int32 len, int32 *esc_len, unsigned char *out,	uint16 outbuflen, uint16 *outlen, Bool force, uint16 win_csid){	uint16 unicode;	char val;	int32 cnt;	*esc_len = 0;	val = 0;	/* Navigator View->source does not support Unicode yet */	if( win_csid == 0 )   win_csid = CS_FE_ASCII;	/*	 * Skip the amperstand character at the start.	 */	buf++;	len--;	/*	 * Ampersand followed by number sign specifies the decimal	 * value of the character to be placed here.	 */	if (*buf == '#')	{		unicode = pa_NumericCharacterReference((unsigned char *) (buf + 1),			(uint32) (len - 1), (uint32 *) esc_len, force );		*esc_len += 1;		#ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR		/* for some illegal, but popular usage */		if( unicode >= 0x0080 && unicode <= 0x009f )			unicode = PA_HackTable[ unicode - 0x0080 ];#endif	}	/*	 * Else we have to look this escape up in	 * the array of valid escapes.	 */	else	{		/*		 * Else we have to look this escape up in		 * the array of valid escapes.		 * Since we are searching on the PA_Name2Unicode[].NE string,		 * and not on the escape entered, this lets us partial		 * match if PA_Name2Unicode[].NE matches a prefix of the escape.		 * This means no one PA_Name2Unicode[].NE should be a prefix		 * of any other PA_Name2Unicode[].NE.		 */		cnt = 0;		while( PA_Name2Unicode[cnt].NE != NULL )		{			if (*buf == *(PA_Name2Unicode[cnt].NE)			    && (XP_STRNCMP(buf+1, PA_Name2Unicode[cnt].NE+1,				PA_Name2Unicode[cnt].len-1) == 0))			{				/*				 * Only match a prefix if the next				 * character is NOT an alphanumeric				 */				/* 				 * The following bug have been related to the following line				 * bug 241429, 57959, 33262, 57912 if you work on this.				 * After we add HTML 4.0 entity table we change the algorithm to prevent                                 * &part= be treat as name entity.				 * The algorithm is as following:				 * If the unicode value is in the Latin 1 range				 *   We mantain the SGML compliant				 * otherwise				 *   We only treat it as name entity if it start from & and end with a ;				*/				if(((PA_Name2Unicode[cnt].unicode <= 256) &&				       (!XP_IS_ALPHA(*(buf + PA_Name2Unicode[cnt].len))) &&				       (!XP_IS_DIGIT(*(buf + PA_Name2Unicode[cnt].len)))				   ) || (';' == (*(buf + PA_Name2Unicode[cnt].len)))				) 				{					unicode = PA_Name2Unicode[cnt].unicode;					*esc_len = PA_Name2Unicode[cnt].len;					break;				}			}			cnt++;		}		/*		 * for invalid escapes, return '\0'		 */		if( PA_Name2Unicode[cnt].NE == NULL )			unicode = NOT_USED;  /* treated as plain text, just for NE */	}	if( unicode == NOT_USED )	{		out[0] = 0;		return;	}	/*	if( outbuflen >= INTL_UnicodeToStrLen( win_csid, &unicode, 1 ) ) 		I needn't to do that, for the outbuflen is always larget than outlen ,		the result of generated "out" through NE/NCR is one byte or two bytes */	INTL_UnicodeToStr( win_csid, &unicode, 1, out, outbuflen );	/*	Remap  NBSP to international version 	*/	/*	We need to do this in any case 		*/	if(unicode == 0x00a0)	{		strcpy((char*)out, INTL_NonBreakingSpace(win_csid));	}	*outlen = XP_STRLEN((char*) out );	/* 	Do fallback for Copyright, Tradmark and Register Sign */	/*	We try those non-standard secret platform specific	  */	/*  codepoint first. 									  */	/*	If there are no such, do an ASCII fallback 			  */	if((*outlen == 1) && (*out == '?'))	{		char* r = NULL;#if defined(XP_WIN) || defined(XP_OS2)		/*					For Winodows			All the CP 125x single byte pages encode				Copyright Signed as A9				Register Signed as 	AE				Tradmark Signed as 	99			Two Byte Asian Font do not have those sign 		*/		switch(unicode)		{			case 0x20AC:				r = "EUR"; 				break;			case 0x00A9:				switch(win_csid)				{					case CS_LATIN1: 	case CS_CP_1250: 						case CS_CP_1251: 	case CS_CP_1253: 						case CS_CP_1254: 	case CS_8859_7:					case CS_8859_9:						r = "\xa9"; 						break;					default:						r = "(C)"; 							break;				}					break;			case 0x00AE:				switch(win_csid)				{					case CS_LATIN1: 	case CS_CP_1250:					case CS_CP_1251: 	case CS_CP_1253:					case CS_CP_1254: 	case CS_8859_7:					case CS_8859_9:						r = "\xae"; 						break;					default:						r = "(R)"; 							break;				}					break;			case 0x2122:				switch(win_csid)				{					case CS_LATIN1: 	case CS_CP_1250:					case CS_CP_1251: 	case CS_CP_1253:					case CS_CP_1254: 	case CS_8859_7:					case CS_8859_9:						r = "\x99"; 						break;					default:						r = "[tm]"; 							break;				}					break;		}#endif#ifdef XP_MAC	/*		For Mac:			Japanese and Chinese font usually have secret glyph 				Copyright Signed at 0xfd				Tradmark Signed at 0xff	*/		switch(unicode)		{			case 0x20AC:				r = "EUR"; 				break;			case 0x00A9:				switch(win_csid)				{					case CS_MAC_ROMAN: 						case CS_MAC_GREEK:						r = "\xd9"; 						break;					case CS_MAC_CE: 						case CS_MAC_CYRILLIC:						r = "\xa9"; 						break;					case CS_KSC_8BIT:						r = "\x93"; 						break;					case CS_SJIS: 							case CS_GB_8BIT:					case CS_CNS_8BIT:						r = "\xfd"; 						break;					case CS_TIS620:						r = "\xfb"; 						break;					default:						r = "(C)"; 							break;				}					break;			case 0x00AE:				switch(win_csid)				{					case CS_MAC_ROMAN: 						case CS_MAC_GREEK:					case CS_MAC_CE: 						case CS_MAC_CYRILLIC:						r = "\xa8"; 						break;					case CS_TIS620:						r = "\xfa"; 						break;					default:						r = "(R)"; 							break;				}					break;			case 0x2122:				switch(win_csid)				{					case CS_MAC_ROMAN: 						case CS_MAC_GREEK:					case CS_MAC_CE: 						case CS_MAC_CYRILLIC:						r = "\xaa"; 						break;					case CS_SJIS: 							case CS_GB_8BIT:					case CS_CNS_8BIT:						r = "\xfe"; 						break;					case CS_TIS620:						r = "\xee"; 						break;					default:						r = "[tm]"; 	break;				}					break;		}#endif #ifdef XP_UNIX 		switch(unicode)		{			case 0x20AC:				r = "EUR"; 					break;			case 0x00A9:				switch(win_csid)				{					default:						r = "(C)"; 							break;				}					break;			case 0x00AE:				switch(win_csid)				{					default:						r = "(R)"; 							break;				}					break;			case 0x0152:				switch(win_csid)				{					default:						r = "OE"; 							break;				}					break;			case 0x0153:				switch(win_csid)				{					default:						r = "oe"; 							break;				}					break;			case 0x0160:				switch(win_csid)				{					default:						r = "S"; 							break;				}					break;			case 0x0161:				switch(win_csid)				{					default:						r = "s"; 							break;				}					break;			case 0x0178:				switch(win_csid)				{					default:						r = "Y"; 							break;				}					break;			case 0x0192:				switch(win_csid)				{					default:						r = "f"; 							break;				}					break;			case 0x02C6:				switch(win_csid)				{					default:						r = "^"; 							break;				}					break;			case 0x02DC:				switch(win_csid)				{					default:						r = "~"; 							break;				}					break;			case 0x2013:				switch(win_csid)				{					default:						r = "-"; 							break;				}					break;			case 0x2014:				switch(win_csid)				{					default:						r = "-"; 							break;				}					break;			case 0x2018:				switch(win_csid)				{					default:						r = "`"; 							break;				}					break;			case 0x2019:				switch(win_csid)				{					default:						r = "'"; 							break;				}					break;			case 0x201C:				switch(win_csid)				{					default:						r = "\""; 							break;				}					break;			case 0x201D:				switch(win_csid)				{					default:						r = "\""; 							break;				}					break;			case 0x201A:				switch(win_csid)				{					default:						r = ","; 							break;				}					break;			case 0x201E:				switch(win_csid)				{					default:						r = ",,"; 							break;				}					break;			case 0x2022:				switch(win_csid)				{					default:						r = "*"; 							break;				}					break;			case 0x2026:				switch(win_csid)				{					default:						r = "..."; 							break;				}					break;			case 0x2039:				switch(win_csid)				{					default:						r = "<"; 							break;				}					break;			case 0x203A:				switch(win_csid)				{					default:						r = ">"; 							break;				}					break;			case 0x2122:				switch(win_csid)				{					default:						r = "[tm]"; 							break;				}					break;		}#endif		if(r != NULL )		{			strcpy((char*)out, r);			*outlen = XP_STRLEN((char*)out);		}	}} 