Changeset 31812


Ignore:
Timestamp:
07/20/17 16:16:44 (3 years ago)
Author:
ak19
Message:

The newer changes to Escape.pm's escape_char() that Dr Bainbridge found do work, my perl setup was wrong when I last tried it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/URI/Escape.pm

    r31781 r31812  
    204204# https://rt.cpan.org/Public/Bug/Display.html?id=105109
    205205# https://github.com/libwww-perl/uri/commit/7e03cdd3e5d25df5556a36dbfcd5d6cbcd676afb
    206 # escape_char is buggy as it assigns meaning to the string's storage format.
     206# XXX FIXME escape_char is buggy as it assigns meaning to the string's storage format.
    207207sub escape_char {
    208208
    209209    # to fix new "\C is deprecated in regex" warning in 5.21.2 (RT#96941)
    210210    #return join '', @URI::Escape::escapes{$_[0] =~ /(\C)/g};
     211
     212    # Old versions of utf8::is_utf8() didn't properly handle magical vars (e.g. $1).
     213    # The following forces a fetch to occur beforehand.
     214    my $dummy = substr($_[0], 0, 0);
     215
    211216    if (utf8::is_utf8($_[0])) {
    212         my $s = $_[0];
     217        my $s = shift;
    213218        utf8::encode($s);
    214219        unshift(@_, $s);
    215220    }
    216    
    217     return join '', @URI::Escape::escapes{$_[0] =~ /(.)/sg};
     221
     222    return join '', @URI::Escape::escapes{split //, $_[0]};   
    218223}
    219224
Note: See TracChangeset for help on using the changeset viewer.