Changeset 23514


Ignore:
Timestamp:
2010-12-20T00:22:43+13:00 (13 years ago)
Author:
davidb
Message:

Two small, but important changes:

1)Javascripts form of escaping puts in a 'u', as in #u1025

2)When URL encoding a filename we need to encode any literal '%' character into its %xx form as well.

File:
1 edited

Legend:

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

    r23387 r23514  
    633633    if ((defined $and_numeric_entities) && ($and_numeric_entities)) {
    634634    $text =~ s/\&\#x([0-9A-F]+);/pack('C', hex($1))/ige;
    635     $text =~ s/\&\#([0-9]+);/pack('C', $1)/ige;
     635    $text =~ s/\&\#u?([0-9]+);/pack('C', $1)/ige;
    636636    }
    637637
     
    764764    = map { $_ > 255 ?                  # Needs to be represent in entity form
    765765            sprintf("&#x%X;",$_) : 
    766             $_ > 128 ?              # Representable in %XX form
     766            $_>128 || $_==ord("%") ?              # Representable in %XX form
    767767            sprintf("%%%2X", $_) : 
    768768            chr($_)                 # otherwise, Ascii char
Note: See TracChangeset for help on using the changeset viewer.