Ignore:
Timestamp:
2010-12-01T13:13:56+13:00 (13 years ago)
Author:
sjm84
Message:

C and Posix added to the possible locales as well as removing the possibility that the filename encoding will come out as "undefined"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/BasePlugin.pm

    r23363 r23364  
    654654    if (!defined $self->{'filesystem_encoding'}) {
    655655    $self->{'filesystem_encoding'} = $self->get_filesystem_encoding();
    656     $self->{'filesystem_encoding'} = "undefined" if !defined $self->{'filesystem_encoding'};
    657656    }
    658657
     
    760759    my $current_locale = setlocale(LC_CTYPE);
    761760   
    762     if ($current_locale =~ m/^.*\.(.*?)$/) {
    763         my $char_encoding = lc($1);
     761    my $char_encoding = undef;
     762    if ($current_locale =~ m/\./) {
     763        ($char_encoding) = ($current_locale =~ m/^.*\.(.*?)$/);
     764        $char_encoding = lc($char_encoding);
     765    }
     766    else {
     767        if ($current_locale =~ m/^(posix|c)$/i) {
     768        $char_encoding = "ascii";
     769        }
     770    }
     771
     772    if (defined $char_encoding) {
    764773        if ($char_encoding =~ m/^(iso)(8859)(\d{1,2})$/) {
    765774        $char_encoding = "$1\_$2\_$3";
     
    942951
    943952    my $url_encoded_filename;
    944     if (defined $filename_encoding) {
     953    if ((defined $filename_encoding) && ($filename_encoding ne "ascii")) {
    945954    # => Generate a pretty print version of filename that is mapped to Unicode
    946955   
Note: See TracChangeset for help on using the changeset viewer.