pike.git / lib / modules / Search.pmod / Filter.pmod / Charset.pmod

version» Context lines:

pike.git/lib/modules/Search.pmod/Filter.pmod/Charset.pmod:47:    return data;   }      string decode_http( string data, mapping headers,    string default_charset )   {    // 1: Is there a Content-type location with a charset specifier?    string ct;    if( (ct = headers["content-type"])    && sscanf( ct, "%*scharset=%[^;]", ct ) == 2 ) -  return decode_charset( data, String.trim_all_whites( ct ) ); +  return decode_charset( data, String.trim( ct ) );       // 2: Find <meta> header in the first Kb of data.    int done;    void do_meta(Parser.HTML p, mapping m)    {    if( done ) return;    if( (lower_case(m->name||"")=="content-type") ||    (lower_case(m["http-equiv"]||"")=="content-type") ||    (lower_case(m["httpequiv"]||"")=="content-type") ||    (lower_case(m["http-equiv"]||"")=="contenttype") ||    (lower_case(m["httpequiv"]||"")=="contenttype") )    {    if( (ct = m->content||m->data)    && sscanf( ct, "%*scharset=%[^;]", ct ) == 2 )    { -  data=decode_charset( data, String.trim_all_whites( ct )); +  data=decode_charset( data, String.trim( ct ));    done=1;    }    }    };       Parser.HTML p = Parser.HTML()->add_tag( "meta", do_meta );    p->ignore_unknown(1);    p->match_tag(0);    p->case_insensitive_tag(1);    p->feed( data[..1024] );