Changeset 23750

Show
Ignore:
Timestamp:
02.03.2011 15:51:18 (9 years ago)
Author:
davidb
Message:

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

Files:
1 modified

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) = @_;