messagingappbase/smilengine/xhtml/src/xhtmlentityconverter.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Provides CXhtmlEntityConverter class methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <gmxmlcomposer.h>
       
    21 #include <gmxmldocument.h>
       
    22 #include <gmxmlparser.h>
       
    23 #include <gmxmlnode.h>
       
    24 #include <gmxmlelement.h>
       
    25 #include <gmxmlcharacterdata.h>
       
    26 #include <gmxmlcomment.h>
       
    27 #include <gmxmlconstants.h>
       
    28 #include <gmxmlentityconverter.h>
       
    29 
       
    30 #include "xhtmlentityconverter.h"
       
    31 
       
    32 const TUint KEntityStart = '&';
       
    33 const TUint KEntityEnd = ';';
       
    34 
       
    35 _LIT(KNbspEntity,"&nbsp;"); 
       
    36 _LIT(KIexclEntity,"&iexcl;"); 
       
    37 _LIT(KCentEntity,"&cent;"); 
       
    38 _LIT(KPoundEntity,"&pound;"); 
       
    39 _LIT(KCurrenEntity,"&curren;"); 
       
    40 _LIT(KYenEntity,"&yen;"); 
       
    41 _LIT(KBrvbarEntity,"&brvbar;"); 
       
    42 _LIT(KSectEntity,"&sect;"); 
       
    43 _LIT(KUmlEntity,"&uml;"); 
       
    44 _LIT(KCopyEntity,"&copy;"); 
       
    45 _LIT(KordfEntity,"&ordf;"); 
       
    46 _LIT(KLaquoEntity,"&laquo;"); 
       
    47 _LIT(KNotEntity,"&not;"); 
       
    48 _LIT(KShyEntity,"&shy;"); 
       
    49 _LIT(KRegEntity,"&reg;"); 
       
    50 _LIT(KMacrEntity,"&macr;"); 
       
    51 _LIT(KDegEntity,"&deg;"); 
       
    52 _LIT(KPlusmnEntity,"&plusmn;"); 
       
    53 _LIT(KSup2Entity,"&sup2;"); 
       
    54 _LIT(KSup3Entity,"&sup3;"); 
       
    55 _LIT(KAcuteEntity,"&acute;"); 
       
    56 _LIT(KMicroEntity,"&micro;"); 
       
    57 _LIT(KParaEntity,"&para;"); 
       
    58 _LIT(KMiddotEntity,"&middot;"); 
       
    59 _LIT(KCedilEntity,"&cedil;"); 
       
    60 _LIT(KSup1Entity,"&sup1;"); 
       
    61 _LIT(KOrdmEntity,"&ordm;"); 
       
    62 _LIT(KRaquoEntity,"&raquo;"); 
       
    63 _LIT(KFrac14Entity,"&frac14;"); 
       
    64 _LIT(KFrac12Entity,"&frac12;"); 
       
    65 _LIT(KFrac34Entity,"&frac34;"); 
       
    66 _LIT(KIquestEntity,"&iquest;");
       
    67  
       
    68 _LIT(KAgraveEntity,"&Agrave;"); 
       
    69 _LIT(KAacuteEntity,"&Aacute;"); 
       
    70 _LIT(KAcircEntity,"&Acirc;"); 
       
    71 _LIT(KAtildeEntity,"&Atilde;"); 
       
    72 _LIT(KAumlEntity,"&Auml;"); 
       
    73 _LIT(KAringEntity,"&Aring;"); 
       
    74 _LIT(KAeligEntity,"&AElig;"); 
       
    75 _LIT(KCcedilEntity,"&Ccedil;"); 
       
    76 _LIT(KEgraveEntity,"&Egrave;"); 
       
    77 _LIT(KEacuteEntity,"&Eacute;"); 
       
    78 _LIT(KEcircEntity,"&Ecirc;"); 
       
    79 _LIT(KEumlEntity,"&Euml;"); 
       
    80 _LIT(KIgraveEntity,"&Igrave;"); 
       
    81 _LIT(KIacuteEntity,"&Iacute;"); 
       
    82 _LIT(KIcircEntity,"&Icirc;"); 
       
    83 _LIT(KIumlEntity,"&Iuml;"); 
       
    84 _LIT(KEthEntity,"&ETH;"); 
       
    85 _LIT(KNtildeEntity,"&Ntilde;"); 
       
    86 _LIT(KOgraveEntity,"&Ograve;"); 
       
    87 _LIT(KOacuteEntity,"&Oacute;");
       
    88 _LIT(KOcircEntity,"&Ocirc;"); 
       
    89 _LIT(KOtildeEntity,"&Otilde;");
       
    90 _LIT(KOumlEntity,"&Ouml;");  
       
    91 _LIT(KTimesEntity,"&times;");  
       
    92 _LIT(KOslashEntity,"&Oslash;");  
       
    93 _LIT(KUgraveEntity,"&Ugrave;"); 
       
    94 _LIT(KUacuteEntity,"&Uacute;");
       
    95 _LIT(KUcircEntity,"&Ucirc;"); 
       
    96 _LIT(KUumlEntity,"&Uuml;");  
       
    97 _LIT(KYacuteEntity,"&Yacute;");  
       
    98 _LIT(KThornEntity,"&THORN;");  
       
    99 _LIT(KSzligEntity,"&szlig;");  
       
   100 _LIT(KagraveEntity,"&agrave;");  
       
   101 _LIT(KaacuteEntity,"&aacute;");  
       
   102 _LIT(KacircEntity,"&acirc;");  
       
   103 _LIT(KatildeEntity,"&atilde;");  
       
   104 _LIT(KaumlEntity,"&auml;");  
       
   105 _LIT(KaringEntity,"&aring;");  
       
   106 _LIT(KaeligEntity,"&aelig;");  
       
   107 _LIT(KccedilEntity,"&ccedil;");  
       
   108 _LIT(KegraveEntity,"&egrave;");  
       
   109 _LIT(KeacuteEntity,"&eacute;");  
       
   110 _LIT(KecircEntity,"&ecirc;");  
       
   111 _LIT(KeumlEntity,"&euml;"); 
       
   112 _LIT(KigraveEntity,"&igrave;");  
       
   113 _LIT(KiacuteEntity,"&iacute;");  
       
   114 _LIT(KicircEntity,"&icirc;");  
       
   115 _LIT(KiumlEntity,"&iuml;");  
       
   116 _LIT(KethEntity,"&eth;");  
       
   117 _LIT(KntildeEntity,"&ntilde;");  
       
   118 _LIT(KograveEntity,"&ograve;"); 
       
   119 _LIT(KoacuteEntity,"&oacute;");
       
   120 _LIT(KocircEntity,"&ocirc;"); 
       
   121 _LIT(KotildeEntity,"&otilde;");
       
   122 _LIT(KoumlEntity,"&ouml;");
       
   123 _LIT(KDivideEntity,"&divide;");
       
   124 _LIT(KoslashEntity,"&oslash;");
       
   125 _LIT(KugraveEntity,"&ugrave;");
       
   126 _LIT(KuacuteEntity,"&uacute;");
       
   127 _LIT(KucircEntity,"&ucirc;");
       
   128 _LIT(KuumlEntity,"&uuml;");
       
   129 _LIT(KyacuteEntity,"&yacute;");
       
   130 _LIT(KthornEntity,"&thorn;");
       
   131 _LIT(KyumlEntity,"&yuml;");
       
   132 
       
   133 _LIT(KfnofEntity,"&fnof;");
       
   134 
       
   135 _LIT(KAlphaEntity,"&Alpha;");
       
   136 _LIT(KBetaEntity,"&Beta;");
       
   137 _LIT(KGammaEntity,"&Gamma;");
       
   138 _LIT(KDeltaEntity,"&Delta;");
       
   139 _LIT(KEpsilonEntity,"&Epsilon;");
       
   140 _LIT(KZetaEntity,"&Zeta;");
       
   141 _LIT(KEtaEntity,"&Eta;");
       
   142 _LIT(KThetaEntity,"&Theta;");
       
   143 _LIT(KIotaEntity,"&Iota;");
       
   144 _LIT(KKappaEntity,"&Kappa;");
       
   145 _LIT(KLambdaEntity,"&Lambda;");
       
   146 _LIT(KMuEntity,"&Mu;");
       
   147 _LIT(KNuEntity,"&Nu;");
       
   148 _LIT(KXiEntity,"&Xi;");
       
   149 _LIT(KOmicronEntity,"&Omicron;");
       
   150 _LIT(KPiEntity,"&Pi;");
       
   151 _LIT(KRhoEntity,"&Rho;");
       
   152 _LIT(KSigmaEntity,"&Sigma;");
       
   153 _LIT(KTauEntity,"&Tau;");
       
   154 _LIT(KUpsilonEntity,"&Upsilon;");
       
   155 _LIT(KPhiEntity,"&Phi;");
       
   156 _LIT(KChiEntity,"&Chi;");
       
   157 _LIT(KPsiEntity,"&Psi;");
       
   158 _LIT(KOmegaEntity,"&Omega;");
       
   159 
       
   160 _LIT(KalphaEntity,"&alpha;");
       
   161 _LIT(KbetaEntity,"&beta;");
       
   162 _LIT(KgammaEntity,"&gamma;");
       
   163 _LIT(KdeltaEntity,"&delta;");
       
   164 _LIT(KepsilonEntity,"&epsilon;");
       
   165 _LIT(KzetaEntity,"&zeta;");
       
   166 _LIT(KetaEntity,"&eta;");
       
   167 _LIT(KthetaEntity,"&theta;");
       
   168 _LIT(KiotaEntity,"&iota;");
       
   169 _LIT(KkappaEntity,"&kappa;");
       
   170 _LIT(KlambdaEntity,"&lambda;");
       
   171 _LIT(KmuEntity,"&mu;");
       
   172 _LIT(KnuEntity,"&nu;");
       
   173 _LIT(KxiEntity,"&xi;");
       
   174 _LIT(KomicronEntity,"&omicron;");
       
   175 _LIT(KpiEntity,"&pi;");
       
   176 _LIT(KrhoEntity,"&rho;");
       
   177 _LIT(KsigmafEntity,"&sigmaf;");
       
   178 _LIT(KsigmaEntity,"&sigma;");
       
   179 _LIT(KtauEntity,"&tau;");
       
   180 _LIT(KupsilonEntity,"&upsilon;");
       
   181 _LIT(KphiEntity,"&phi;");
       
   182 _LIT(KchiEntity,"&chi;");
       
   183 _LIT(KpsiEntity,"&psi;");
       
   184 _LIT(KomegaEntity,"&omega;");
       
   185 _LIT(KThetasymEntity,"&thetasym;");
       
   186 _LIT(KUpsihEntity,"&upsih;");
       
   187 _LIT(KPivEntity,"&piv;");
       
   188 //
       
   189 _LIT(KbullEntity,"&bull;");
       
   190 _LIT(KhellipEntity,"&hellip;");
       
   191 _LIT(KprimeEntity,"&prime;");
       
   192 _LIT(KPrimeEntity,"&Prime;");
       
   193 _LIT(KolineEntity,"&oline;");
       
   194 _LIT(KfraslEntity,"&frasl;");
       
   195 //Letterlike symbols
       
   196 _LIT(KweierpEntity,"&weierp;");
       
   197 _LIT(KimageEntity,"&image;");
       
   198 _LIT(KrealEntity,"&real;");
       
   199 _LIT(KtradeEntity,"&trade;");
       
   200 _LIT(KalefsymEntity,"&alefsym;");
       
   201 //Arrows
       
   202 _LIT(KlarrEntity,"&larr;");
       
   203 _LIT(KuarrEntity,"&uarr;");
       
   204 _LIT(KrarrEntity,"&rarr;");
       
   205 _LIT(KdarrEntity,"&darr;");
       
   206 _LIT(KharrEntity,"&harr;");
       
   207 _LIT(KcrarrEntity,"&crarr;");
       
   208 _LIT(KlArrEntity,"&lArr;");
       
   209 _LIT(KuArrEntity,"&uArr;");
       
   210 _LIT(KrArrEntity,"&rArr;");
       
   211 _LIT(KdArrEntity,"&dArr;");
       
   212 _LIT(KhArrEntity,"&hArr;");
       
   213 //Mathematical operators
       
   214 _LIT(KForallEntity,"&forall;");
       
   215 _LIT(KPartEntity,"&part;");
       
   216 _LIT(KExistEntity,"&exist;");
       
   217 _LIT(KEmptyEntity,"&empty;");
       
   218 _LIT(KNablaEntity,"&nabla;");
       
   219 _LIT(KIsinEntity,"&isin;");
       
   220 _LIT(KNotinEntity,"&notin;");
       
   221 _LIT(KNiEntity,"&ni;");
       
   222 _LIT(KProdEntity,"&prod;");
       
   223 _LIT(KSumEntity,"&sum;");
       
   224 _LIT(KMinusEntity,"&minus;");
       
   225 _LIT(KLowastEntity,"&lowast;");
       
   226 _LIT(KRadicEntity,"&radic;");
       
   227 _LIT(KPropEntity,"&prop;");
       
   228 _LIT(KInfinEntity,"&infin;");
       
   229 _LIT(KAngEntity,"&ang;");
       
   230 _LIT(KAndEntity,"&and;");
       
   231 _LIT(KOrEntity,"&or;");
       
   232 _LIT(KCapEntity,"&cap;");
       
   233 _LIT(KCupEntity,"&cup;");
       
   234 _LIT(KIntEntity,"&int;");
       
   235 _LIT(KThere4Entity,"&there4;");
       
   236 _LIT(KsimEntity,"&sim;");
       
   237 _LIT(KCongEntity,"&cong;");
       
   238 _LIT(KAsympEntity,"&asymp;");
       
   239 _LIT(KNeEntity,"&ne;");
       
   240 _LIT(KEquivEntity,"&equiv;");
       
   241 _LIT(KLeEntity,"&le;");
       
   242 _LIT(KGeEntity,"&ge;");
       
   243 _LIT(KSubEntity,"&sub;");
       
   244 _LIT(KSupEntity,"&sup;");
       
   245 _LIT(KNsubEntity,"&nsub;");
       
   246 _LIT(KSubeEntity,"&sube;");
       
   247 _LIT(KSupeEntity,"&supe;");
       
   248 _LIT(KOplusEntity,"&oplus;");
       
   249 _LIT(KOtimesEntity,"&otimes;");
       
   250 _LIT(KperpEntity,"&perp;");
       
   251 _LIT(KSdotEntity,"&sdot;");
       
   252 
       
   253 _LIT(KLceilEntity,"&lceil;");
       
   254 _LIT(KRceilEntity,"&rceil;");
       
   255 _LIT(KLfloorEntity,"&lfloor;");
       
   256 _LIT(KRfloorEntity,"&rfloor;");
       
   257 _LIT(KlangEntity,"&lang;");
       
   258 _LIT(KRangEntity,"&rang;");
       
   259 _LIT(KLozEntity,"&loz;");
       
   260 _LIT(KSpadesEntity,"&spades;");
       
   261 _LIT(KClubsEntity,"&clubs;");
       
   262 _LIT(KHeartsEntity,"&hearts;");
       
   263 _LIT(KdiamsEntity,"&diams;");
       
   264 _LIT(KLtEntity,"&lt;");
       
   265 _LIT(KGtEntity,"&gt;");
       
   266 _LIT(KAmpEntity,"&amp;");
       
   267 _LIT(KAposEntity,"&apos;");
       
   268 _LIT(KQuotEntity,"&quot;");
       
   269 _LIT(KOEligEntity,"&OElig;");
       
   270 _LIT(KoeligEntity,"&oelig;");
       
   271 _LIT(KScaronEntity,"&Scaron;");
       
   272 _LIT(KscaronEntity,"&scaron;");
       
   273 _LIT(KYumlEntity,"&Yuml;");
       
   274 _LIT(KCircEntity,"&circ;");
       
   275 _LIT(KtildeEntity,"&tilde;");
       
   276 _LIT(KEnspEntity,"&ensp;");
       
   277 _LIT(KemspEntity,"&emsp;");
       
   278 _LIT(KThinspEntity,"&thinsp;");
       
   279 _LIT(KZwnjEntity,"&zwnj;");
       
   280 _LIT(KZwjEntity,"&zwj;");
       
   281 _LIT(KLrmEntity,"&lrm;");
       
   282 _LIT(KRlmEntity,"&rlm;");
       
   283 _LIT(KNdashEntity,"&ndash;");
       
   284 _LIT(KMdashEntity,"&mdash;");
       
   285 _LIT(KLsquoEntity,"&lsquo;");
       
   286 _LIT(KRsquoEntity,"&rsquo;");
       
   287 _LIT(KsbquoEntity,"&sbquo;");
       
   288 _LIT(KldquoEntity,"&ldquo;");
       
   289 _LIT(KRdquoEntity,"&rdquo;");
       
   290 _LIT(KbdquoEntity,"&bdquo;");
       
   291 _LIT(KdaggerEntity,"&dagger;");
       
   292 _LIT(KDaggerEntity,"&Dagger;");
       
   293 _LIT(KpermilEntity,"&permil;");
       
   294 _LIT(KLsaquoEntity,"&lsaquo;");
       
   295 _LIT(KRsaquoEntity,"&rsaquo;");
       
   296 _LIT(KEuroEntity,"&euro;");
       
   297 
       
   298 
       
   299 
       
   300 // ---------------------------------------------------------
       
   301 // CXhtmlEntityConverter::OutputComposedTextL
       
   302 // ---------------------------------------------------------
       
   303 //
       
   304 
       
   305 TInt CXhtmlEntityConverter::OutputComposedTextL( CMDXMLComposer* aComposer,
       
   306     const TDesC& aTextToConvert )
       
   307     {
       
   308 	TInt error = KErrNone;
       
   309 
       
   310 	TBuf<1> oneChar;
       
   311 	TInt offset = 0;
       
   312 	TInt textLen = aTextToConvert.Length();
       
   313 
       
   314 	while( error == KErrNone && (offset < textLen) )
       
   315 	    {
       
   316 		oneChar = aTextToConvert.Mid( offset, 1 );
       
   317 		offset++;
       
   318 		//return entity code if found
       
   319 		//or oneChar if not
       
   320 		error = aComposer->OutputDataL( MatchEntityString(oneChar) );
       
   321 	    }
       
   322 	return error;
       
   323     }
       
   324 
       
   325 
       
   326 // ---------------------------------------------------------
       
   327 // CXhtmlEntityConverter::DTDEntityToText
       
   328 // ---------------------------------------------------------
       
   329 //
       
   330 TInt CXhtmlEntityConverter::DTDEntityToText( TDes& aTextToConvert )
       
   331     {
       
   332 	TInt entityStart (-1);
       
   333     TInt currentPos (0);
       
   334     
       
   335     TBool entityFound( EFalse );
       
   336 
       
   337     while( currentPos < aTextToConvert.Length() )
       
   338         {
       
   339         if( aTextToConvert[currentPos] == KEntityStart )
       
   340             {
       
   341             //Found entity start
       
   342             entityFound = ETrue;
       
   343             entityStart = currentPos;
       
   344             currentPos++;
       
   345             }
       
   346         else if( aTextToConvert[currentPos] == KEntityEnd && entityFound )
       
   347             {
       
   348             // Found entity end
       
   349             if( HandleEntity(aTextToConvert ,entityStart, currentPos - entityStart + 1) )
       
   350                 {
       
   351                 //Continue searching from entity start
       
   352                 currentPos = entityStart;
       
   353                 }
       
   354             else
       
   355                 {
       
   356                 //If the entity was not valid we move on.
       
   357                 currentPos++;
       
   358                 }
       
   359 
       
   360             entityStart = -1;
       
   361             entityFound = EFalse;
       
   362             }
       
   363         else
       
   364             {
       
   365             currentPos++;
       
   366             }
       
   367         }
       
   368 	return KErrNone;
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------
       
   372 // CXhtmlEntityConverter::HandleEntity
       
   373 //
       
   374 // Handles replacing of single character entity with real unicode character.
       
   375 // ---------------------------------------------------------
       
   376 //
       
   377 TBool CXhtmlEntityConverter::HandleEntity( TDes& aData, TInt aStart, TInt aLength )
       
   378     {
       
   379     TPtrC entity = aData.Mid( aStart, aLength );
       
   380 
       
   381     //Buffer that holds the unicode that is used to replaces the entity
       
   382     TBuf16<1> entityCode;
       
   383 
       
   384     if( MatchEntityCode( entity, entityCode ) )
       
   385         {
       
   386         aData.Replace( aStart, aLength, entityCode );
       
   387         return ETrue;
       
   388         }
       
   389     else
       
   390         {
       
   391         return EFalse;
       
   392         }
       
   393     }
       
   394 
       
   395 // ---------------------------------------------------------
       
   396 // CXhtmlEntityConverter::MatchEntityCode
       
   397 //
       
   398 // Matches the entity with the unicode character value.
       
   399 // ---------------------------------------------------------
       
   400 //
       
   401 TBool CXhtmlEntityConverter::MatchEntityCode( const TDesC& aEntity, TDes& aEntityCode )
       
   402     {
       
   403     TBool result( EFalse );
       
   404     aEntityCode.SetLength( 1 );
       
   405 
       
   406     if(aEntity == KNbspEntity) { aEntityCode[0] = 0xa0;  result = ETrue; }
       
   407     else if(aEntity == KIexclEntity) { aEntityCode[0] = 0xa1; result = ETrue; }
       
   408     else if(aEntity == KCentEntity) {  aEntityCode[0] = 0xa2; result = ETrue; }
       
   409     else if(aEntity == KPoundEntity) { aEntityCode[0] = 0xa3; result = ETrue; }
       
   410     else if(aEntity == KCurrenEntity) { aEntityCode[0] = 0xa4; result = ETrue; }
       
   411     else if(aEntity == KYenEntity) { aEntityCode[0] = 0xa5; result = ETrue; }
       
   412     else if(aEntity == KBrvbarEntity) { aEntityCode[0] = 0xa6; result = ETrue; }
       
   413     else if(aEntity == KSectEntity) { aEntityCode[0] = 0xa7; result = ETrue; }
       
   414     else if(aEntity == KUmlEntity) { aEntityCode[0] = 0xa8; result = ETrue; }
       
   415     else if(aEntity == KCopyEntity) { aEntityCode[0] = 0xa9; result = ETrue; }
       
   416     else if(aEntity == KordfEntity) { aEntityCode[0] = 0xaa; result = ETrue; }
       
   417     else if(aEntity == KLaquoEntity) { aEntityCode[0] = 0xab; result = ETrue; }
       
   418     else if(aEntity == KNotEntity) { aEntityCode[0] = 0xac; result = ETrue; }
       
   419     else if(aEntity == KShyEntity) { aEntityCode[0] = 0xad; result = ETrue; }
       
   420 	else if(aEntity == KAgraveEntity) { aEntityCode[0] = 0xc0; result = ETrue; }
       
   421     else if(aEntity == KRegEntity) { aEntityCode[0] = 0xae; result = ETrue; }
       
   422     else if(aEntity == KMacrEntity) { aEntityCode[0] = 0xaf; result = ETrue; }
       
   423     else if(aEntity == KDegEntity) { aEntityCode[0] = 0xb0; result = ETrue; }
       
   424     else if(aEntity == KPlusmnEntity) { aEntityCode[0] = 0xb1; result = ETrue; }
       
   425     else if(aEntity == KSup2Entity) { aEntityCode[0] = 0xb2; result = ETrue; }
       
   426     else if(aEntity == KSup3Entity) { aEntityCode[0] = 0xb3; result = ETrue; }
       
   427     else if(aEntity == KAcuteEntity) { aEntityCode[0] = 0xb4; result = ETrue; }
       
   428     else if(aEntity == KMicroEntity) { aEntityCode[0] = 0xb5; result = ETrue; }
       
   429     else if(aEntity == KParaEntity) { aEntityCode[0] = 0xb6; result = ETrue; }
       
   430     else if(aEntity == KMiddotEntity) { aEntityCode[0] = 0xb7; result = ETrue; }
       
   431     else if(aEntity == KCedilEntity) { aEntityCode[0] = 0xb8; result = ETrue; }
       
   432     else if(aEntity == KSup1Entity) { aEntityCode[0] = 0xb9; result = ETrue; }
       
   433     else if(aEntity == KOrdmEntity) { aEntityCode[0] = 0xba; result = ETrue; }
       
   434     else if(aEntity == KRaquoEntity) { aEntityCode[0] = 0xbb; result = ETrue; }
       
   435     else if(aEntity == KFrac14Entity) { aEntityCode[0] = 0xbc; result = ETrue; }
       
   436     else if(aEntity == KFrac12Entity) { aEntityCode[0] = 0xbd; result = ETrue; }
       
   437     else if(aEntity == KFrac34Entity) { aEntityCode[0] = 0xbe; result = ETrue; }
       
   438     else if(aEntity == KIquestEntity) { aEntityCode[0] = 0xbf; result = ETrue; }
       
   439 	else if(aEntity == KCircEntity) { aEntityCode[0] = 0x2c6; result = ETrue; }
       
   440 	else if(aEntity == KtildeEntity) { aEntityCode[0] = 0x2dc; result = ETrue; }
       
   441 	else if(aEntity == KEnspEntity) { aEntityCode[0] = 0x2002; result = ETrue; }
       
   442 	else if(aEntity == KemspEntity) { aEntityCode[0] = 0x2003; result = ETrue; }
       
   443 	else if(aEntity == KThinspEntity) { aEntityCode[0] = 0x2009; result = ETrue; }
       
   444 	else if(aEntity == KZwnjEntity) { aEntityCode[0] = 0x200c; result = ETrue; }
       
   445 	else if(aEntity == KZwjEntity) { aEntityCode[0] = 0x200d; result = ETrue; }
       
   446 	else if(aEntity == KLrmEntity) { aEntityCode[0] = 0x200e; result = ETrue; }
       
   447 	else if(aEntity == KRlmEntity) { aEntityCode[0] = 0x200f; result = ETrue; }
       
   448 	else if(aEntity == KNdashEntity) { aEntityCode[0] = 0x2013; result = ETrue; }
       
   449 	else if(aEntity == KMdashEntity) { aEntityCode[0] = 0x2014; result = ETrue; }
       
   450 	else if(aEntity == KLsquoEntity) { aEntityCode[0] = 0x2018; result = ETrue; }
       
   451 	else if(aEntity == KRsquoEntity) { aEntityCode[0] = 0x2019; result = ETrue; }
       
   452 	else if(aEntity == KsbquoEntity) { aEntityCode[0] = 0x201a; result = ETrue; }
       
   453 	else if(aEntity == KldquoEntity) { aEntityCode[0] = 0x201c; result = ETrue; }
       
   454 	else if(aEntity == KRdquoEntity) { aEntityCode[0] = 0x201d; result = ETrue; }
       
   455 	else if(aEntity == KbdquoEntity) { aEntityCode[0] = 0x201e; result = ETrue; }
       
   456 	else if(aEntity == KdaggerEntity) { aEntityCode[0] = 0x2020; result = ETrue; }
       
   457 	else if(aEntity == KDaggerEntity) { aEntityCode[0] = 0x2021; result = ETrue; }
       
   458 	else if(aEntity == KpermilEntity) { aEntityCode[0] = 0x2030; result = ETrue; }
       
   459 	else if(aEntity == KLsaquoEntity) { aEntityCode[0] = 0x2039; result = ETrue; }
       
   460 	else if(aEntity == KRsaquoEntity) { aEntityCode[0] = 0x203a; result = ETrue; }
       
   461 	else if(aEntity == KEuroEntity) { aEntityCode[0] = 0x20ac; result = ETrue; }
       
   462 
       
   463     if( result )
       
   464         {
       
   465         return result;
       
   466         }
       
   467     // Capital latin characters
       
   468     if(aEntity == KAgraveEntity) { aEntityCode[0] = 0xc0; result = ETrue; }
       
   469     else if(aEntity == KAacuteEntity) { aEntityCode[0] = 0xc1; result = ETrue; }
       
   470     else if(aEntity == KAcircEntity) { aEntityCode[0] = 0xc2; result = ETrue; }
       
   471     else if(aEntity == KAtildeEntity) { aEntityCode[0] = 0xc3; result = ETrue; }
       
   472     else if(aEntity == KAumlEntity) { aEntityCode[0] = 0xc4; result = ETrue; }
       
   473     else if(aEntity == KAringEntity) { aEntityCode[0] = 0xc5; result = ETrue; }
       
   474     else if(aEntity == KAeligEntity) { aEntityCode[0] = 0xc6; result = ETrue; }
       
   475     else if(aEntity == KCcedilEntity) { aEntityCode[0] = 0xc7; result = ETrue; }
       
   476     else if(aEntity == KEgraveEntity) { aEntityCode[0] = 0xc8; result = ETrue; }
       
   477     else if(aEntity == KEacuteEntity) { aEntityCode[0] = 0xc9; result = ETrue; }
       
   478     else if(aEntity == KEcircEntity) { aEntityCode[0] = 0xca; result = ETrue; }
       
   479     else if(aEntity == KEumlEntity) { aEntityCode[0] = 0xcb; result = ETrue; }
       
   480     else if(aEntity == KIgraveEntity) { aEntityCode[0] = 0xcc; result = ETrue; }
       
   481     else if(aEntity == KIacuteEntity) { aEntityCode[0] = 0xcd; result = ETrue; }
       
   482     else if(aEntity == KIcircEntity) { aEntityCode[0] = 0xce; result = ETrue; }
       
   483     else if(aEntity == KIumlEntity) { aEntityCode[0] = 0xcf; result = ETrue; }
       
   484     else if(aEntity == KEthEntity) { aEntityCode[0] = 0xd0; result = ETrue; }
       
   485     else if(aEntity == KNtildeEntity) { aEntityCode[0] = 0xd1; result = ETrue; }
       
   486     else if(aEntity == KOgraveEntity) { aEntityCode[0] = 0xd2; result = ETrue; }
       
   487     else if(aEntity == KOacuteEntity) { aEntityCode[0] = 0xd3; result = ETrue; }
       
   488     else if(aEntity == KOcircEntity) { aEntityCode[0] = 0xd4; result = ETrue; }
       
   489     else if(aEntity == KOtildeEntity) { aEntityCode[0] = 0xd5; result = ETrue; }
       
   490     else if(aEntity == KOumlEntity) { aEntityCode[0] = 0xd6; result = ETrue; }
       
   491     else if(aEntity == KTimesEntity) { aEntityCode[0] = 0xd7; result = ETrue; }
       
   492     else if(aEntity == KOslashEntity) { aEntityCode[0] = 0xd8; result = ETrue; }
       
   493     else if(aEntity == KUgraveEntity) { aEntityCode[0] = 0xd9; result = ETrue; }
       
   494     else if(aEntity == KUacuteEntity) { aEntityCode[0] = 0xda; result = ETrue; }
       
   495     else if(aEntity == KUcircEntity) { aEntityCode[0] = 0xdb; result = ETrue; }
       
   496     else if(aEntity == KUumlEntity) { aEntityCode[0] = 0xdc; result = ETrue; }
       
   497     else if(aEntity == KYacuteEntity) { aEntityCode[0] = 0xdd; result = ETrue; }
       
   498     else if(aEntity == KThornEntity) { aEntityCode[0] = 0xde; result = ETrue; }
       
   499 	else if(aEntity == KOEligEntity) { aEntityCode[0] = 0x0152; result = ETrue; }
       
   500 	else if(aEntity == KoeligEntity) { aEntityCode[0] = 0x0153; result = ETrue; }
       
   501 	else if(aEntity == KScaronEntity) { aEntityCode[0] = 0x160; result = ETrue; }
       
   502 	else if(aEntity == KscaronEntity) { aEntityCode[0] = 0x161; result = ETrue; }
       
   503 	else if(aEntity == KYumlEntity) { aEntityCode[0] = 0x178; result = ETrue; }
       
   504 
       
   505 	if( result )
       
   506         {
       
   507         return result;
       
   508         }
       
   509     // Small latin characters 
       
   510     if(aEntity == KSzligEntity) { aEntityCode[0] = 0xdf; result = ETrue; }
       
   511     else if(aEntity == KagraveEntity) { aEntityCode[0] = 0xe0; result = ETrue; }
       
   512     else if(aEntity == KaacuteEntity) { aEntityCode[0] = 0xe1; result = ETrue; }
       
   513     else if(aEntity == KacircEntity) { aEntityCode[0] = 0xe2; result = ETrue; }
       
   514     else if(aEntity == KatildeEntity) { aEntityCode[0] = 0xe3; result = ETrue; }
       
   515     else if(aEntity == KaumlEntity) { aEntityCode[0] = 0xe4; result = ETrue; }
       
   516     else if(aEntity == KaringEntity) { aEntityCode[0] = 0xe5; result = ETrue; }
       
   517     else if(aEntity == KaeligEntity) { aEntityCode[0] = 0xe6; result = ETrue; }
       
   518     else if(aEntity == KccedilEntity) { aEntityCode[0] = 0xe7; result = ETrue; }
       
   519     else if(aEntity == KegraveEntity) { aEntityCode[0] = 0xe8; result = ETrue; }
       
   520     else if(aEntity == KeacuteEntity) { aEntityCode[0] = 0xe9; result = ETrue; }
       
   521     else if(aEntity == KecircEntity) { aEntityCode[0] = 0xea; result = ETrue; }
       
   522     else if(aEntity == KeumlEntity) { aEntityCode[0] = 0xeb; result = ETrue; }
       
   523     else if(aEntity == KigraveEntity) { aEntityCode[0] = 0xec; result = ETrue; }
       
   524     else if(aEntity == KiacuteEntity) { aEntityCode[0] = 0xed; result = ETrue; }
       
   525     else if(aEntity == KicircEntity) { aEntityCode[0] = 0xee; result = ETrue; }
       
   526     else if(aEntity == KiumlEntity) { aEntityCode[0] = 0xef; result = ETrue; }
       
   527     else if(aEntity == KethEntity) { aEntityCode[0] = 0xf0; result = ETrue; }
       
   528     else if(aEntity == KntildeEntity) { aEntityCode[0] = 0xf1; result = ETrue; }
       
   529     else if(aEntity == KograveEntity) { aEntityCode[0] = 0xf2; result = ETrue; }
       
   530     else if(aEntity == KoacuteEntity) { aEntityCode[0] = 0xf3; result = ETrue; }
       
   531     else if(aEntity == KocircEntity) { aEntityCode[0] = 0xf4; result = ETrue; }
       
   532     else if(aEntity == KotildeEntity) { aEntityCode[0] = 0xf5; result = ETrue; }
       
   533     else if(aEntity == KoumlEntity) { aEntityCode[0] = 0xf6; result = ETrue; }
       
   534     else if(aEntity == KDivideEntity) { aEntityCode[0] = 0xf7; result = ETrue; }
       
   535     else if(aEntity == KoslashEntity) { aEntityCode[0] = 0xf8; result = ETrue; }
       
   536     else if(aEntity == KugraveEntity) { aEntityCode[0] = 0xf9; result = ETrue; }
       
   537     else if(aEntity == KuacuteEntity) { aEntityCode[0] = 0xfa; result = ETrue; }
       
   538     else if(aEntity == KucircEntity) { aEntityCode[0] = 0xfb; result = ETrue; }
       
   539     else if(aEntity == KuumlEntity) { aEntityCode[0] = 0xfc; result = ETrue; }
       
   540     else if(aEntity == KyacuteEntity) { aEntityCode[0] = 0xfd; result = ETrue; }
       
   541     else if(aEntity == KthornEntity) { aEntityCode[0] = 0xfe; result = ETrue; }
       
   542     else if(aEntity == KyumlEntity) { aEntityCode[0] = 0xff; result = ETrue; }
       
   543 
       
   544     if( result )
       
   545         {
       
   546         return result;
       
   547         }
       
   548     // Capital greek characters
       
   549     if(aEntity == KAlphaEntity) { aEntityCode[0] = 0x391; result = ETrue; }
       
   550     else if(aEntity == KBetaEntity) { aEntityCode[0] = 0x392; result = ETrue; }
       
   551     else if(aEntity == KGammaEntity) { aEntityCode[0] = 0x393; result = ETrue; }
       
   552     else if(aEntity == KDeltaEntity) { aEntityCode[0] = 0x394; result = ETrue; }
       
   553     else if(aEntity == KEpsilonEntity) { aEntityCode[0] = 0x395; result = ETrue; }
       
   554     else if(aEntity == KZetaEntity) { aEntityCode[0] = 0x396; result = ETrue; }
       
   555     else if(aEntity == KEtaEntity) { aEntityCode[0] = 0x397; result = ETrue; }
       
   556     else if(aEntity == KThetaEntity) { aEntityCode[0] = 0x398; result = ETrue; }
       
   557     else if(aEntity == KIotaEntity) { aEntityCode[0] = 0x399; result = ETrue; }
       
   558     else if(aEntity == KKappaEntity) { aEntityCode[0] = 0x39a; result = ETrue; }
       
   559     else if(aEntity == KLambdaEntity) { aEntityCode[0] = 0x39b; result = ETrue; }
       
   560     else if(aEntity == KMuEntity) { aEntityCode[0] = 0x39c; result = ETrue; }
       
   561     else if(aEntity == KNuEntity) { aEntityCode[0] = 0x39d; result = ETrue; }
       
   562     else if(aEntity == KXiEntity) { aEntityCode[0] = 0x39e; result = ETrue; }
       
   563     else if(aEntity == KOmicronEntity) { aEntityCode[0] = 0x39f; result = ETrue; }
       
   564     else if(aEntity == KPiEntity) { aEntityCode[0] = 0x3a0; result = ETrue; }
       
   565     else if(aEntity == KRhoEntity) { aEntityCode[0] = 0x3a1; result = ETrue; }
       
   566     else if(aEntity == KSigmaEntity) { aEntityCode[0] = 0x3a3; result = ETrue; }
       
   567     else if(aEntity == KTauEntity) { aEntityCode[0] = 0x3a4; result = ETrue; }
       
   568     else if(aEntity == KUpsilonEntity) { aEntityCode[0] = 0x3a5; result = ETrue; }
       
   569     else if(aEntity == KPhiEntity) { aEntityCode[0] = 0x3a6; result = ETrue; }
       
   570     else if(aEntity == KChiEntity) { aEntityCode[0] = 0x3a7; result = ETrue; }
       
   571     else if(aEntity == KPsiEntity) { aEntityCode[0] = 0x3a8; result = ETrue; }
       
   572     else if(aEntity == KOmegaEntity) { aEntityCode[0] = 0x3a9; result = ETrue; }
       
   573     // Small greek characters
       
   574     else if(aEntity == KalphaEntity) { aEntityCode[0] = 0x3b1; result = ETrue; }
       
   575     else if(aEntity == KbetaEntity) { aEntityCode[0] = 0x3b2; result = ETrue; }
       
   576     else if(aEntity == KgammaEntity) { aEntityCode[0] = 0x3b3; result = ETrue; }
       
   577     else if(aEntity == KdeltaEntity) { aEntityCode[0] = 0x3b4; result = ETrue; }
       
   578     else if(aEntity == KepsilonEntity) { aEntityCode[0] = 0x3b5; result = ETrue; }
       
   579     else if(aEntity == KzetaEntity) { aEntityCode[0] = 0x3b6; result = ETrue; }
       
   580     else if(aEntity == KetaEntity) { aEntityCode[0] = 0x3b7; result = ETrue; }
       
   581     else if(aEntity == KthetaEntity) { aEntityCode[0] = 0x3b8; result = ETrue; }
       
   582     else if(aEntity == KiotaEntity) { aEntityCode[0] = 0x3b9; result = ETrue; }
       
   583     else if(aEntity == KkappaEntity) { aEntityCode[0] = 0x3ba; result = ETrue; }
       
   584     else if(aEntity == KlambdaEntity) { aEntityCode[0] = 0x3bb; result = ETrue; }
       
   585     else if(aEntity == KmuEntity) { aEntityCode[0] = 0x3bc; result = ETrue; }
       
   586     else if(aEntity == KnuEntity) { aEntityCode[0] = 0x3bd; result = ETrue; }
       
   587     else if(aEntity == KxiEntity) { aEntityCode[0] = 0x3be; result = ETrue; }
       
   588     else if(aEntity == KomicronEntity) { aEntityCode[0] = 0x3bf; result = ETrue; }
       
   589     else if(aEntity == KpiEntity) { aEntityCode[0] = 0x3c0; result = ETrue; }
       
   590     else if(aEntity == KrhoEntity) { aEntityCode[0] = 0x3c1; result = ETrue; }
       
   591     else if(aEntity == KsigmafEntity) { aEntityCode[0] = 0x3c2; result = ETrue; }
       
   592     else if(aEntity == KsigmaEntity) { aEntityCode[0] = 0x3c3; result = ETrue; }
       
   593     else if(aEntity == KtauEntity) { aEntityCode[0] = 0x3c4; result = ETrue; }
       
   594     else if(aEntity == KupsilonEntity) { aEntityCode[0] = 0x3c5; result = ETrue; }
       
   595     else if(aEntity == KphiEntity) { aEntityCode[0] = 0x3c6; result = ETrue; }
       
   596     else if(aEntity == KchiEntity) { aEntityCode[0] = 0x3c7; result = ETrue; }
       
   597     else if(aEntity == KpsiEntity) { aEntityCode[0] = 0x3c8; result = ETrue; }
       
   598     else if(aEntity == KomegaEntity) { aEntityCode[0] = 0x3c9; result = ETrue; }
       
   599     else if(aEntity == KThetasymEntity) { aEntityCode[0] = 0x3d1; result = ETrue; }
       
   600     else if(aEntity == KUpsihEntity) { aEntityCode[0] = 0x3d2; result = ETrue; }
       
   601     else if(aEntity == KPivEntity) { aEntityCode[0] = 0x3d6; result = ETrue; }
       
   602 	else if(aEntity == KfnofEntity) { aEntityCode[0] = 0x192; result = ETrue; }
       
   603 	else if(aEntity == KbullEntity) { aEntityCode[0] = 0x2219; result = ETrue; }
       
   604 	else if(aEntity == KhellipEntity) { aEntityCode[0] = 0x2026; result = ETrue; }
       
   605 	else if(aEntity == KprimeEntity) { aEntityCode[0] = 0x2032; result = ETrue; }
       
   606 	else if(aEntity == KPrimeEntity) { aEntityCode[0] = 0x2033; result = ETrue; }
       
   607 	else if(aEntity == KolineEntity) { aEntityCode[0] = 0x203e; result = ETrue; }
       
   608 	else if(aEntity == KfraslEntity) { aEntityCode[0] = 0x2044; result = ETrue; }
       
   609 
       
   610 	if( result )
       
   611         {
       
   612         return result;
       
   613         }
       
   614 	if(aEntity == KweierpEntity) { aEntityCode[0] = 0x2118; result = ETrue; }
       
   615 	else if(aEntity == KimageEntity) { aEntityCode[0] = 0x2111; result = ETrue; }
       
   616 	else if(aEntity == KrealEntity) { aEntityCode[0] = 0x211c; result = ETrue; }
       
   617 	else if(aEntity == KtradeEntity) { aEntityCode[0] = 0x2122; result = ETrue; }
       
   618 	else if(aEntity == KalefsymEntity) { aEntityCode[0] = 0x2135; result = ETrue; }
       
   619 	else if(aEntity == KlarrEntity) { aEntityCode[0] = 0x2190; result = ETrue; }
       
   620 	else if(aEntity == KuarrEntity) { aEntityCode[0] = 0x2191; result = ETrue; }
       
   621 	else if(aEntity == KrarrEntity) { aEntityCode[0] = 0x2192; result = ETrue; }
       
   622 	else if(aEntity == KdarrEntity) { aEntityCode[0] = 0x2193; result = ETrue; }
       
   623 	else if(aEntity == KharrEntity) { aEntityCode[0] = 0x2194; result = ETrue; }
       
   624 	else if(aEntity == KcrarrEntity) { aEntityCode[0] = 0x21b5; result = ETrue; }
       
   625 	else if(aEntity == KlArrEntity) { aEntityCode[0] = 0x21d0; result = ETrue; }
       
   626 	else if(aEntity == KuArrEntity) { aEntityCode[0] = 0x21d1; result = ETrue; }
       
   627 	else if(aEntity == KrArrEntity) { aEntityCode[0] = 0x21d2; result = ETrue; }
       
   628 	else if(aEntity == KdArrEntity) { aEntityCode[0] = 0x21d3; result = ETrue; }
       
   629 	else if(aEntity == KhArrEntity) { aEntityCode[0] = 0x21d4; result = ETrue; }
       
   630 	else if(aEntity == KForallEntity) { aEntityCode[0] = 0x2200; result = ETrue; }
       
   631 	else if(aEntity == KPartEntity) { aEntityCode[0] = 0x2202; result = ETrue; }
       
   632 	else if(aEntity == KExistEntity) { aEntityCode[0] = 0x2203; result = ETrue; }
       
   633 	else if(aEntity == KEmptyEntity) { aEntityCode[0] = 0x2205; result = ETrue; }
       
   634 	else if(aEntity == KNablaEntity) { aEntityCode[0] = 0x2207; result = ETrue; } 
       
   635 	else if(aEntity == KIsinEntity) { aEntityCode[0] = 0x2208; result = ETrue; }
       
   636 	else if(aEntity == KNotinEntity) { aEntityCode[0] = 0x2209; result = ETrue; }
       
   637 	else if(aEntity == KNiEntity) { aEntityCode[0] = 0x220b; result = ETrue; }
       
   638 	else if(aEntity == KProdEntity) { aEntityCode[0] = 0x220f; result = ETrue; }
       
   639 	else if(aEntity == KSumEntity) { aEntityCode[0] = 0x2211; result = ETrue; }
       
   640 	else if(aEntity == KMinusEntity) { aEntityCode[0] = 0x2212; result = ETrue; }
       
   641 	else if(aEntity == KLowastEntity) { aEntityCode[0] = 0x2217; result = ETrue; }
       
   642 	else if(aEntity == KRadicEntity) { aEntityCode[0] = 0x221a; result = ETrue; }
       
   643 	else if(aEntity == KPropEntity) { aEntityCode[0] = 0x221d; result = ETrue; }
       
   644 	else if(aEntity == KInfinEntity) { aEntityCode[0] = 0x221e; result = ETrue; }
       
   645 	else if(aEntity == KAngEntity) { aEntityCode[0] = 0x2220; result = ETrue; }
       
   646 	else if(aEntity == KAndEntity) { aEntityCode[0] = 0x2227; result = ETrue; }
       
   647 	else if(aEntity == KOrEntity) { aEntityCode[0] = 0x2228; result = ETrue; }
       
   648 	else if(aEntity == KCapEntity) { aEntityCode[0] = 0x2229; result = ETrue; }
       
   649 	else if(aEntity == KCupEntity) { aEntityCode[0] = 0x222a; result = ETrue; }
       
   650 	else if(aEntity == KIntEntity) { aEntityCode[0] = 0x222b; result = ETrue; }
       
   651 	else if(aEntity == KThere4Entity) { aEntityCode[0] = 0x2234; result = ETrue; }
       
   652 	else if(aEntity == KsimEntity) { aEntityCode[0] = 0x223c; result = ETrue; }
       
   653 	else if(aEntity == KCongEntity) { aEntityCode[0] = 0x2245; result = ETrue; }
       
   654 	else if(aEntity == KAsympEntity) { aEntityCode[0] = 0x2248; result = ETrue; }
       
   655 	else if(aEntity == KNeEntity) { aEntityCode[0] = 0x2260; result = ETrue; }
       
   656 	else if(aEntity == KEquivEntity) { aEntityCode[0] = 0x2261; result = ETrue; }
       
   657 	else if(aEntity == KLeEntity) { aEntityCode[0] = 0x2264; result = ETrue; }
       
   658 	else if(aEntity == KGeEntity) { aEntityCode[0] = 0x2265; result = ETrue; }
       
   659 	else if(aEntity == KSubEntity) { aEntityCode[0] = 0x2282; result = ETrue; }
       
   660 	else if(aEntity == KSupEntity) { aEntityCode[0] = 0x2283; result = ETrue; }
       
   661 	else if(aEntity == KNsubEntity) { aEntityCode[0] = 0x2284; result = ETrue; }
       
   662 	else if(aEntity == KSubeEntity) { aEntityCode[0] = 0x2286; result = ETrue; }
       
   663 	else if(aEntity == KSupeEntity) { aEntityCode[0] = 0x2287; result = ETrue; }
       
   664 	else if(aEntity == KOplusEntity) { aEntityCode[0] = 0x2295; result = ETrue; }
       
   665 	else if(aEntity == KOtimesEntity) { aEntityCode[0] = 0x2297; result = ETrue; }
       
   666 	else if(aEntity == KperpEntity) { aEntityCode[0] = 0x22a5; result = ETrue; }
       
   667 	else if(aEntity == KSdotEntity) { aEntityCode[0] = 0x22c5; result = ETrue; }
       
   668 	else if(aEntity == KLceilEntity) { aEntityCode[0] = 0x2308; result = ETrue; }
       
   669 	else if(aEntity == KRceilEntity) { aEntityCode[0] = 0x2309; result = ETrue; }
       
   670 	else if(aEntity == KLfloorEntity) { aEntityCode[0] = 0x230a; result = ETrue; }
       
   671 	else if(aEntity == KRfloorEntity) { aEntityCode[0] = 0x230b; result = ETrue; }
       
   672 	else if(aEntity == KlangEntity) { aEntityCode[0] = 0x2329; result = ETrue; }
       
   673 	else if(aEntity == KRangEntity) { aEntityCode[0] = 0x232a; result = ETrue; }
       
   674 	else if(aEntity == KLozEntity) { aEntityCode[0] = 0x25ca; result = ETrue; }
       
   675 	else if(aEntity == KSpadesEntity) { aEntityCode[0] = 0x2660; result = ETrue; }
       
   676 	else if(aEntity == KClubsEntity) { aEntityCode[0] = 0x2663; result = ETrue; }
       
   677 	else if(aEntity == KHeartsEntity) { aEntityCode[0] = 0x2665; result = ETrue; }
       
   678 	else if(aEntity == KdiamsEntity) { aEntityCode[0] = 0x2666; result = ETrue; }
       
   679 	
       
   680 
       
   681     return result;
       
   682 
       
   683     }
       
   684 
       
   685 // ---------------------------------------------------------
       
   686 // CXhtmlEntityConverter::MatchEntityString
       
   687 // ---------------------------------------------------------
       
   688 //
       
   689 
       
   690 TPtrC CXhtmlEntityConverter::MatchEntityString( const TDesC& aEntityCode ) const
       
   691     {
       
   692 	TPtrC x;
       
   693 
       
   694 	if(aEntityCode.Length() < 1)
       
   695     {
       
   696         x.Set(KNbspEntity);
       
   697         return x;       
       
   698     }
       
   699 
       
   700     if(aEntityCode[0] == 0xa0) { x.Set(KNbspEntity); return x; }
       
   701 	if(aEntityCode[0] == 0xa1) { x.Set(KIexclEntity); return x; }
       
   702     if(aEntityCode[0] == 0xa2) { x.Set(KCentEntity); return x; }
       
   703     if(aEntityCode[0] == 0xa3) { x.Set(KPoundEntity); return x; }
       
   704     if(aEntityCode[0] == 0xa4) { x.Set(KCurrenEntity ); return x; }
       
   705     if(aEntityCode[0] == 0xa5) { x.Set(KYenEntity ); return x; }
       
   706     if(aEntityCode[0] == 0xa6) { x.Set(KBrvbarEntity );return x; }
       
   707     if(aEntityCode[0] == 0xa7) { x.Set(KSectEntity );return x; }
       
   708     if(aEntityCode[0] == 0xa8) { x.Set(KUmlEntity ); return x; }
       
   709     if(aEntityCode[0] == 0xa9) { x.Set(KCopyEntity ); return x; }
       
   710     if(aEntityCode[0] == 0xaa) { x.Set(KordfEntity ); return x; }
       
   711     if(aEntityCode[0] == 0xab) { x.Set(KLaquoEntity ); return x; }
       
   712     if(aEntityCode[0] == 0xac ) { x.Set(KNotEntity); return x; }
       
   713     if(aEntityCode[0] == 0xad ) { x.Set(KShyEntity); return x; }
       
   714     if(aEntityCode[0] == 0xae ) { x.Set(KRegEntity); return x; }
       
   715     if(aEntityCode[0] == 0xaf ) { x.Set(KMacrEntity); return x; }
       
   716     if(aEntityCode[0] == 0xb0 ) { x.Set(KDegEntity); return x; }
       
   717     if(aEntityCode[0] == 0xb1 ) { x.Set(KPlusmnEntity); return x; }
       
   718     if(aEntityCode[0] == 0xb2 ) { x.Set(KSup2Entity); return x; }
       
   719     if(aEntityCode[0] == 0xb3 ) { x.Set(KSup3Entity); return x; }
       
   720     if(aEntityCode[0] == 0xb4 ) { x.Set(KAcuteEntity); return x; }
       
   721     if(aEntityCode[0] == 0xb5 ) { x.Set(KMicroEntity); return x; }
       
   722     if(aEntityCode[0] == 0xb6 ) { x.Set(KParaEntity); return x; }
       
   723     if(aEntityCode[0] == 0xb7 ) { x.Set(KMiddotEntity); return x; }
       
   724     if(aEntityCode[0] == 0xb8 ) { x.Set(KCedilEntity); return x; }
       
   725     if(aEntityCode[0] == 0xb9 ) { x.Set(KSup1Entity); return x; }
       
   726     if(aEntityCode[0] == 0xba ) { x.Set(KOrdmEntity); return x; }
       
   727     if(aEntityCode[0] == 0xbb ) { x.Set(KRaquoEntity); return x; }
       
   728     if(aEntityCode[0] == 0xbc ) { x.Set(KFrac14Entity); return x;  }
       
   729     if(aEntityCode[0] == 0xbd ) { x.Set(KFrac12Entity); return x; }
       
   730     if(aEntityCode[0] == 0xbe ) { x.Set(KFrac34Entity); return x; }
       
   731     if(aEntityCode[0] == 0xbf ) { x.Set(KIquestEntity); return x; }
       
   732      // Capital latin characters
       
   733     if(aEntityCode[0] == 0xc0) { x.Set(KAgraveEntity ); return x; }
       
   734     if(aEntityCode[0] == 0xc1) { x.Set(KAacuteEntity ); return x; }
       
   735     if(aEntityCode[0] == 0xc2) { x.Set(KAcircEntity ); return x; }
       
   736     if(aEntityCode[0] == 0xc3) { x.Set(KAtildeEntity ); return x; }
       
   737     if(aEntityCode[0] == 0xc4) { x.Set(KAumlEntity ); return x; }
       
   738     if(aEntityCode[0] == 0xc5) { x.Set(KAringEntity ); return x; }
       
   739     if(aEntityCode[0] == 0xc6) { x.Set(KAeligEntity ); return x; }
       
   740     if(aEntityCode[0] == 0xc7) { x.Set(KCcedilEntity ); return x; }
       
   741     if(aEntityCode[0] == 0xc8) { x.Set(KEgraveEntity ); return x; }
       
   742     if(aEntityCode[0] == 0xc9) { x.Set(KEacuteEntity); return x; }
       
   743     if(aEntityCode[0] == 0xca) { x.Set(KEcircEntity ); return x; }
       
   744     if(aEntityCode[0] == 0xcb) { x.Set(KEumlEntity ); return x; }
       
   745     if(aEntityCode[0] == 0xcc) { x.Set(KIgraveEntity ); return x; }
       
   746     if(aEntityCode[0] == 0xcd) { x.Set(KIacuteEntity ); return x; }
       
   747     if(aEntityCode[0] == 0xce) { x.Set(KIcircEntity ); return x; }
       
   748     if(aEntityCode[0] == 0xcf) { x.Set(KIumlEntity); return x; }
       
   749     if(aEntityCode[0] == 0xd0) { x.Set(KEthEntity ); return x;}
       
   750     if(aEntityCode[0] == 0xd1) { x.Set(KNtildeEntity ); return x; }
       
   751     if(aEntityCode[0] == 0xd2) { x.Set(KOgraveEntity); return x; }
       
   752     if(aEntityCode[0] == 0xd3) { x.Set(KOacuteEntity ); return x; }
       
   753     if(aEntityCode[0] == 0xd4) { x.Set(KOcircEntity ); return x; }
       
   754     if(aEntityCode[0] == 0xd5) { x.Set(KOtildeEntity ); return x; }
       
   755     if(aEntityCode[0] == 0xd6) { x.Set(KOumlEntity ); return x; }
       
   756     if(aEntityCode[0] == 0xd7) { x.Set(KTimesEntity ); return x; }
       
   757     if(aEntityCode[0] == 0xd8) { x.Set(KOslashEntity ); return x; }
       
   758     if(aEntityCode[0] == 0xd9) { x.Set(KUgraveEntity ); return x; }
       
   759     if(aEntityCode[0] == 0xda) { x.Set(KUacuteEntity ); return x; }
       
   760     if(aEntityCode[0] == 0xdb) { x.Set(KUcircEntity ); return x; }
       
   761     if(aEntityCode[0] == 0xdc) { x.Set(KUumlEntity ); return x; }
       
   762     if(aEntityCode[0] == 0xdd) { x.Set(KYacuteEntity ); return x; }
       
   763     if(aEntityCode[0] == 0xde) { x.Set(KThornEntity ); return x; }
       
   764     // Small latin characters 
       
   765     if(aEntityCode[0] == 0xdf) { x.Set(KSzligEntity ); return x; }
       
   766     if(aEntityCode[0] == 0xe0) { x.Set(KagraveEntity ); return x; }
       
   767     if(aEntityCode[0] == 0xe1) { x.Set(KaacuteEntity ); return x; }
       
   768     if(aEntityCode[0] == 0xe2) { x.Set(KacircEntity ); return x; }
       
   769     if(aEntityCode[0] == 0xe3) { x.Set(KatildeEntity ); return x; }
       
   770     if(aEntityCode[0] == 0xe4) { x.Set(KaumlEntity ); return x; }
       
   771     if(aEntityCode[0] == 0xe5) { x.Set(KaringEntity); return x; }
       
   772     if(aEntityCode[0] == 0xe6) { x.Set(KIcircEntity ); return x; }
       
   773     if(aEntityCode[0] == 0xe7) { x.Set(KIcircEntity ); return x; }
       
   774     if(aEntityCode[0] == 0xe8) { x.Set(KIcircEntity ); return x; }
       
   775     if(aEntityCode[0] == 0xe9) { x.Set(KeacuteEntity ); return x; }
       
   776     if(aEntityCode[0] == 0xea) { x.Set(KecircEntity ); return x; }
       
   777     if(aEntityCode[0] == 0xeb) { x.Set(KecircEntity ); return x; }
       
   778     if(aEntityCode[0] == 0xec) { x.Set(KigraveEntity ); return x; }
       
   779     if(aEntityCode[0] == 0xed) { x.Set(KiacuteEntity ); return x; }
       
   780     if(aEntityCode[0] == 0xee) { x.Set(KicircEntity ); return x; }
       
   781     if(aEntityCode[0] == 0xef) { x.Set(KiumlEntity ); return x; }
       
   782     if(aEntityCode[0] == 0xf0) { x.Set(KethEntity ); return x; }
       
   783     if(aEntityCode[0] == 0xf1) { x.Set(KntildeEntity ); return x; }
       
   784     if(aEntityCode[0] == 0xf2) { x.Set(KograveEntity ); return x; }
       
   785     if(aEntityCode[0] == 0xf3) { x.Set(KoacuteEntity ); return x; }
       
   786     if(aEntityCode[0] == 0xf4) { x.Set(KocircEntity ); return x; }
       
   787     if(aEntityCode[0] == 0xf5) { x.Set(KotildeEntity ); return x; }
       
   788     if(aEntityCode[0] == 0xf6) { x.Set(KoumlEntity ); return x; }
       
   789     if(aEntityCode[0] == 0xf7) { x.Set(KDivideEntity ); return x; }
       
   790     if(aEntityCode[0] == 0xf8) { x.Set(KoslashEntity ); return x; }
       
   791     if(aEntityCode[0] == 0xf9) { x.Set(KugraveEntity ); return x; }
       
   792     if(aEntityCode[0] == 0xfa) { x.Set(KuacuteEntity ); return x; }
       
   793     if(aEntityCode[0] == 0xfb) { x.Set(KucircEntity ); return x; }
       
   794     if(aEntityCode[0] == 0xfc) { x.Set(KuumlEntity ); return x; }
       
   795     if(aEntityCode[0] == 0xfd) { x.Set(KyacuteEntity ); return x; }
       
   796     if(aEntityCode[0] == 0xfe) { x.Set(KIcircEntity ); return x; }
       
   797     if(aEntityCode[0] == 0xff) { x.Set(KIcircEntity ); return x; }
       
   798     // Capital greek characters
       
   799     if(aEntityCode[0] == 0x391) { x.Set(KIcircEntity ); return x; }
       
   800     if(aEntityCode[0] == 0x392) { x.Set(KIcircEntity ); return x; }
       
   801     if(aEntityCode[0] == 0x393) { x.Set(KIcircEntity ); return x; }
       
   802     if(aEntityCode[0] == 0x394) { x.Set(KIcircEntity ); return x; }
       
   803     if(aEntityCode[0] == 0x395) { x.Set(KIcircEntity ); return x; }
       
   804     if(aEntityCode[0] == 0x396) { x.Set(KIcircEntity ); return x; }
       
   805     if(aEntityCode[0] == 0x397) { x.Set(KEtaEntity ); return x; }
       
   806     if(aEntityCode[0] == 0x398) { x.Set(KThetaEntity ); return x; }
       
   807     if(aEntityCode[0] == 0x399) { x.Set(KIotaEntity ); return x; }
       
   808     if(aEntityCode[0] == 0x39a) { x.Set(KKappaEntity ); return x; }
       
   809     if(aEntityCode[0] == 0x39b) { x.Set(KLambdaEntity ); return x; }
       
   810     if(aEntityCode[0] == 0x39c) { x.Set(KMuEntity ); return x; }
       
   811     if(aEntityCode[0] == 0x39d) { x.Set(KNuEntity ); return x; }
       
   812     if(aEntityCode[0] == 0x39e) { x.Set(KXiEntity ); return x; }
       
   813     if(aEntityCode[0] == 0x39f) { x.Set(KOmicronEntity ); return x; }
       
   814     if(aEntityCode[0] == 0x3a0) { x.Set(KPiEntity ); return x; }
       
   815     if(aEntityCode[0] == 0x3a1) { x.Set(KRhoEntity ); return x; }
       
   816     if(aEntityCode[0] == 0x3a3) { x.Set(KSigmaEntity ); return x; }
       
   817     if(aEntityCode[0] == 0x3a4) { x.Set(KTauEntity ); return x; }
       
   818     if(aEntityCode[0] == 0x3a5) { x.Set(KUpsilonEntity ); return x; }
       
   819     if(aEntityCode[0] == 0x3a6) { x.Set(KPhiEntity ); return x; }
       
   820     if(aEntityCode[0] == 0x3a7) { x.Set(KChiEntity ); return x; }
       
   821     if(aEntityCode[0] == 0x3a8) { x.Set(KPsiEntity ); return x; }
       
   822     if(aEntityCode[0] == 0x3a9) { x.Set(KOmegaEntity ); return x; }
       
   823     // Small greek characters
       
   824     if(aEntityCode[0] == 0x3b1) { x.Set(KalphaEntity ); return x; }
       
   825     if(aEntityCode[0] == 0x3b2) { x.Set(KbetaEntity ); return x; }
       
   826     if(aEntityCode[0] == 0x3b3) { x.Set(KgammaEntity ); return x; }
       
   827     if(aEntityCode[0] == 0x3b4) { x.Set(KdeltaEntity ); return x; }
       
   828     if(aEntityCode[0] == 0x3b5) { x.Set(KepsilonEntity ); return x; }
       
   829     if(aEntityCode[0] == 0x3b6) { x.Set(KzetaEntity ); return x; }
       
   830     if(aEntityCode[0] == 0x3b7) { x.Set(KetaEntity ); return x; }
       
   831     if(aEntityCode[0] == 0x3b8) { x.Set(KthetaEntity ); return x; }
       
   832     if(aEntityCode[0] == 0x3b9) { x.Set(KiotaEntity ); return x; }
       
   833     if(aEntityCode[0] == 0x3ba) { x.Set(KkappaEntity ); return x; }
       
   834     if(aEntityCode[0] == 0x3bb) { x.Set(KlambdaEntity ); return x; }
       
   835     if(aEntityCode[0] == 0x3bc) { x.Set(KmuEntity ); return x; }
       
   836     if(aEntityCode[0] == 0x3bd) { x.Set(KnuEntity ); return x; }
       
   837     if(aEntityCode[0] == 0x3be) { x.Set(KxiEntity ); return x; }
       
   838     if(aEntityCode[0] == 0x3bf) { x.Set(KomicronEntity ); return x; }
       
   839     if(aEntityCode[0] == 0x3c0) { x.Set(KpiEntity ); return x; }
       
   840     if(aEntityCode[0] == 0x3c1) { x.Set(KrhoEntity ); return x; }
       
   841     if(aEntityCode[0] == 0x3c2) { x.Set(KsigmafEntity ); return x; }
       
   842     if(aEntityCode[0] == 0x3c3) { x.Set(KsigmaEntity ); return x; }
       
   843     if(aEntityCode[0] == 0x3c4) { x.Set(KtauEntity ); return x; }
       
   844     if(aEntityCode[0] == 0x3c5) { x.Set(KupsilonEntity ); return x; }
       
   845     if(aEntityCode[0] == 0x3c6) { x.Set(KphiEntity ); return x; }
       
   846     if(aEntityCode[0] == 0x3c7) { x.Set(KchiEntity ); return x; }
       
   847     if(aEntityCode[0] == 0x3c8) { x.Set(KpsiEntity ); return x; }
       
   848     if(aEntityCode[0] == 0x3c9) { x.Set(KomegaEntity ); return x; }
       
   849     if(aEntityCode[0] == 0x3d1) { x.Set(KThetasymEntity ); return x; }
       
   850     if(aEntityCode[0] == 0x3d2) { x.Set(KUpsihEntity ); return x; }
       
   851     if(aEntityCode[0] == 0x3d6) { x.Set(KPivEntity ); return x; }
       
   852 //
       
   853 	if(aEntityCode[0] == 0x192) { x.Set(KfnofEntity ); return x; }
       
   854     if(aEntityCode[0] == 0x2219) { x.Set(KbullEntity ); return x; }
       
   855     if(aEntityCode[0] == 0x2026) { x.Set(KhellipEntity ); return x; }
       
   856     if(aEntityCode[0] == 0x2032) { x.Set(KprimeEntity ); return x; }
       
   857     if(aEntityCode[0] == 0x2033) { x.Set(KPrimeEntity ); return x; }
       
   858     if(aEntityCode[0] == 0x203e) { x.Set(KolineEntity ); return x; }
       
   859     if(aEntityCode[0] == 0x2044) { x.Set(KfraslEntity ); return x; }
       
   860     if(aEntityCode[0] == 0x2118) { x.Set(KweierpEntity ); return x; }
       
   861     if(aEntityCode[0] == 0x2111) { x.Set(KimageEntity ); return x; }
       
   862     if(aEntityCode[0] == 0x211C) { x.Set(KrealEntity ); return x; }
       
   863     if(aEntityCode[0] == 0x2122) { x.Set(KtradeEntity ); return x; }
       
   864     if(aEntityCode[0] == 0x2135) { x.Set(KalefsymEntity ); return x; }
       
   865     if(aEntityCode[0] == 0x2190) { x.Set(KlarrEntity ); return x; }
       
   866     if(aEntityCode[0] == 0x2191) { x.Set(KuarrEntity ); return x; }
       
   867     if(aEntityCode[0] == 0x2192) { x.Set(KrarrEntity ); return x; }
       
   868     if(aEntityCode[0] == 0x2193) { x.Set(KdarrEntity ); return x; }
       
   869     if(aEntityCode[0] == 0x2194) { x.Set(KharrEntity ); return x; }
       
   870     if(aEntityCode[0] == 0x21b5) { x.Set(KlArrEntity ); return x; }
       
   871     if(aEntityCode[0] == 0x21d1) { x.Set(KuArrEntity ); return x; }
       
   872     if(aEntityCode[0] == 0x21d2) { x.Set(KrArrEntity ); return x; }
       
   873     if(aEntityCode[0] == 0x21d3) { x.Set(KdArrEntity ); return x; }
       
   874     if(aEntityCode[0] == 0x21d4) { x.Set(KhArrEntity ); return x; }
       
   875 	
       
   876 	if(aEntityCode[0] == 0x2200) { x.Set(KForallEntity ); return x; }
       
   877     if(aEntityCode[0] == 0x2202) { x.Set(KPartEntity ); return x; }
       
   878     if(aEntityCode[0] == 0x2203) { x.Set(KExistEntity ); return x; }
       
   879     if(aEntityCode[0] == 0x2205) { x.Set(KEmptyEntity ); return x; }
       
   880     if(aEntityCode[0] == 0x2207) { x.Set(KNablaEntity ); return x; }
       
   881 	if(aEntityCode[0] == 0x2208) { x.Set(KIsinEntity ); return x; }
       
   882     if(aEntityCode[0] == 0x2209) { x.Set(KNotinEntity ); return x; }
       
   883     if(aEntityCode[0] == 0x220b) { x.Set(KNiEntity ); return x; }
       
   884     if(aEntityCode[0] == 0x220f) { x.Set(KrarrEntity ); return x; }
       
   885     if(aEntityCode[0] == 0x2211) { x.Set(KSumEntity ); return x; }
       
   886     if(aEntityCode[0] == 0x2212) { x.Set(KMinusEntity ); return x;}
       
   887     if(aEntityCode[0] == 0x2217) { x.Set(KLowastEntity ); return x; }
       
   888     if(aEntityCode[0] == 0x221a) { x.Set(KRadicEntity ); return x; }
       
   889     if(aEntityCode[0] == 0x221d) { x.Set(KPropEntity ); return x; }
       
   890     if(aEntityCode[0] == 0x221e) { x.Set(KInfinEntity ); return x; }
       
   891     if(aEntityCode[0] == 0x2220) { x.Set(KAngEntity ); return x; }
       
   892     if(aEntityCode[0] == 0x2227) { x.Set(KAndEntity ); return x; }
       
   893 	if(aEntityCode[0] == 0x2228) { x.Set(KOrEntity ); return x; }
       
   894     if(aEntityCode[0] == 0x2229) { x.Set(KCapEntity ); return x; }
       
   895     if(aEntityCode[0] == 0x222a) { x.Set(KCupEntity ); return x; }
       
   896     if(aEntityCode[0] == 0x222b) { x.Set(KIntEntity ); return x; }
       
   897     if(aEntityCode[0] == 0x2234) { x.Set(KThere4Entity ); return x; }
       
   898     if(aEntityCode[0] == 0x223c) { x.Set(KsimEntity ); return x; }
       
   899     if(aEntityCode[0] == 0x2245) { x.Set(KCongEntity ); return x; }
       
   900     if(aEntityCode[0] == 0x2248) { x.Set(KAsympEntity ); return x; }
       
   901     if(aEntityCode[0] == 0x2260) { x.Set(KNeEntity ); return x; }
       
   902     if(aEntityCode[0] == 0x2261) { x.Set(KEquivEntity ); return x; }
       
   903     if(aEntityCode[0] == 0x2264) { x.Set(KLeEntity ); return x; }
       
   904     if(aEntityCode[0] == 0x2265) { x.Set(KGeEntity ); return x; }
       
   905 	if(aEntityCode[0] == 0x2282) { x.Set(KSubEntity ); return x; }
       
   906     if(aEntityCode[0] == 0x2283) { x.Set(KSupEntity ); return x; }
       
   907     if(aEntityCode[0] == 0x2284) { x.Set(KNsubEntity ); return x; }
       
   908     if(aEntityCode[0] == 0x2286) { x.Set(KSubeEntity ); return x; }
       
   909     if(aEntityCode[0] == 0x2287) { x.Set(KSupeEntity ); return x; }
       
   910     if(aEntityCode[0] == 0x2295) { x.Set(KOplusEntity ); return x; }
       
   911     if(aEntityCode[0] == 0x2297) { x.Set(KOtimesEntity ); return x; }
       
   912     if(aEntityCode[0] == 0x22a5) { x.Set(KperpEntity ); return x; }
       
   913     if(aEntityCode[0] == 0x22c5) { x.Set(KSdotEntity ); return x; }
       
   914     if(aEntityCode[0] == 0x2308) { x.Set(KLceilEntity ); return x; }
       
   915 
       
   916     if(aEntityCode[0] == 0x2309) { x.Set(KRceilEntity ); return x; }
       
   917     if(aEntityCode[0] == 0x230a) { x.Set(KLfloorEntity ); return x; }
       
   918 	if(aEntityCode[0] == 0x230b) { x.Set(KRfloorEntity ); return x; }
       
   919     if(aEntityCode[0] == 0x2329) { x.Set(KlangEntity ); return x; }
       
   920     if(aEntityCode[0] == 0x232a) { x.Set(KRangEntity ); return x; }
       
   921     
       
   922 	if(aEntityCode[0] == 0x25ca) { x.Set(KLozEntity ); return x; }
       
   923     if(aEntityCode[0] == 0x2660) { x.Set(KSpadesEntity ); return x; }
       
   924     if(aEntityCode[0] == 0x2663) { x.Set(KClubsEntity ); return x; }
       
   925     if(aEntityCode[0] == 0x2665) { x.Set(KHeartsEntity ); return x; }
       
   926     if(aEntityCode[0] == 0x2666) { x.Set(KdiamsEntity ); return x; }
       
   927 
       
   928     if(aEntityCode[0] == 0x3c) { x.Set(KLtEntity ); return x; }
       
   929     if(aEntityCode[0] == 0x3e) { x.Set(KGtEntity ); return x; }
       
   930     if(aEntityCode[0] == 0x26) { x.Set(KAmpEntity ); return x; }
       
   931     if(aEntityCode[0] == 0x27) { x.Set(KAposEntity ); return x; }
       
   932 	if(aEntityCode[0] == 0x22) { x.Set(KQuotEntity ); return x; }
       
   933     if(aEntityCode[0] == 0x152) { x.Set(KOEligEntity ); return x; }
       
   934     if(aEntityCode[0] == 0x153) { x.Set(KoeligEntity ); return x; }
       
   935     if(aEntityCode[0] == 0x160) { x.Set(KScaronEntity ); return x; }
       
   936     if(aEntityCode[0] == 0x161) { x.Set(KscaronEntity ); return x; }
       
   937     if(aEntityCode[0] == 0x178) { x.Set(KYumlEntity ); return x; }
       
   938 
       
   939     if(aEntityCode[0] == 0x2c6) { x.Set(KCircEntity ); return x; }
       
   940     if(aEntityCode[0] == 0x2dc) { x.Set(KtildeEntity ); return x; }
       
   941     if(aEntityCode[0] == 0x2002) { x.Set(KEnspEntity ); return x; }
       
   942     if(aEntityCode[0] == 0x2003) { x.Set(KemspEntity ); return x; }
       
   943     if(aEntityCode[0] == 0x2009) { x.Set(KThinspEntity ); return x; }
       
   944     if(aEntityCode[0] == 0x200c) { x.Set(KZwnjEntity ); return x; }
       
   945 	if(aEntityCode[0] == 0x200d) { x.Set(KZwjEntity ); return x; }
       
   946     if(aEntityCode[0] == 0x200e) { x.Set(KLrmEntity ); return x;  }
       
   947     if(aEntityCode[0] == 0x200f) { x.Set(KRlmEntity ); return x; } 
       
   948     if(aEntityCode[0] == 0x2013) { x.Set(KNdashEntity ); return x; }
       
   949     if(aEntityCode[0] == 0x2014) { x.Set(KMdashEntity ); return x; }
       
   950     if(aEntityCode[0] == 0x2018) { x.Set(KLsquoEntity ); return x; }
       
   951     if(aEntityCode[0] == 0x2019) { x.Set(KRsquoEntity ); return x; }
       
   952     if(aEntityCode[0] == 0x201a) { x.Set(KsbquoEntity ); return x; }
       
   953     if(aEntityCode[0] == 0x201c) { x.Set(KldquoEntity ); return x; }
       
   954     if(aEntityCode[0] == 0x201d) { x.Set(KRdquoEntity ); return x; }
       
   955     if(aEntityCode[0] == 0x201e) { x.Set(KbdquoEntity ); return x; }
       
   956     if(aEntityCode[0] == 0x2020) { x.Set(KdaggerEntity ); return x; }
       
   957 	if(aEntityCode[0] == 0x2021) { x.Set(KDaggerEntity ); return x; }
       
   958     if(aEntityCode[0] == 0x2030) { x.Set(KpermilEntity ); return x; }
       
   959     if(aEntityCode[0] == 0x2039) { x.Set(KLsaquoEntity ); return x; }
       
   960     if(aEntityCode[0] == 0x203a) { x.Set(KRsaquoEntity ); return x; }
       
   961     if(aEntityCode[0] == 0x20ac) { x.Set(KEuroEntity ); return x; }
       
   962     
       
   963     return aEntityCode;
       
   964     }