Changeset 39cc341


Ignore:
Timestamp:
2006-01-03T18:30:54Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
13c4cd3
Parents:
a252c1a
Message:

strip_html now replaces non-ASCII characters (entities like &eacute;) to
their UTF-8 versions instead of Latin1. Also added &[aeiou]uml; entities
to the list. However, I still don't know if this is really important anyway...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    ra252c1a r39cc341  
    181181{
    182182        char code[8];
    183         char is;
     183        char is[4];
    184184} htmlentity_t;
    185185
    186186/* FIXME: This is ISO8859-1(5) centric, so might cause problems with other charsets. */
    187187
    188 static htmlentity_t ent[] =
    189 {
    190         { "lt",     '<' },
    191         { "gt",     '>' },
    192         { "amp",    '&' },
    193         { "quot",   '"' },
    194         { "aacute", 'á' },
    195         { "eacute", 'é' },
    196         { "iacute", 'é' },
    197         { "oacute", 'ó' },
    198         { "uacute", 'ú' },
    199         { "agrave", 'à' },
    200         { "egrave", 'è' },
    201         { "igrave", 'ì' },
    202         { "ograve", 'ò' },
    203         { "ugrave", 'ù' },
    204         { "acirc",  'â' },
    205         { "ecirc",  'ê' },
    206         { "icirc",  'î' },
    207         { "ocirc",  'ô' },
    208         { "ucirc",  'û' },
    209         { "nbsp",   ' ' },
    210         { "",        0  }
     188static const htmlentity_t ent[] =
     189{
     190        { "lt",     "<" },
     191        { "gt",     ">" },
     192        { "amp",    "&" },
     193        { "quot",   "\"" },
     194        { "aacute", "á" },
     195        { "eacute", "é" },
     196        { "iacute", "é" },
     197        { "oacute", "ó" },
     198        { "uacute", "ú" },
     199        { "agrave", "à" },
     200        { "egrave", "è" },
     201        { "igrave", "ì" },
     202        { "ograve", "ò" },
     203        { "ugrave", "ù" },
     204        { "acirc",  "â" },
     205        { "ecirc",  "ê" },
     206        { "icirc",  "î" },
     207        { "ocirc",  "ô" },
     208        { "ucirc",  "û" },
     209        { "auml",   "ä" },
     210        { "euml",   "ë" },
     211        { "iuml",   "ï" },
     212        { "ouml",   "ö" },
     213        { "uuml",   "ü" },
     214        { "nbsp",   " " },
     215        { "",        ""  }
    211216};
    212217
     
    257262                                if( g_strncasecmp( ent[i].code, cs, strlen( ent[i].code ) ) == 0 )
    258263                                {
    259                                         *(s++) = ent[i].is;
     264                                        int j;
     265                                       
     266                                        for( j = 0; ent[i].is[j]; j ++ )
     267                                                *(s++) = ent[i].is[j];
     268                                       
    260269                                        matched = 1;
    261270                                        break;
Note: See TracChangeset for help on using the changeset viewer.