Changeset 23750 for main


Ignore:
Timestamp:
2011-03-02T15:51:18+13:00 (13 years ago)
Author:
davidb
Message:

Extra routine added for decoding URLs in %XX format that express UTF8 character encodings. Returns unicode-aware string

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/unicode.pm

    r23514 r23750  
    639639}
    640640
     641sub url_decode_utf8 {
     642    my ($text,$and_numeric_entities) = @_;
     643
     644    $text =~ s/\%([0-9A-F]{2})/pack('b', hex($1))/ige;
     645
     646    $text = Encode::decode("utf8",$text);
     647
     648    return $text;
     649}
     650
    641651sub is_url_encoded {
    642652    my ($text) = @_;
Note: See TracChangeset for help on using the changeset viewer.