Changeset 1891 for trunk/gsdl


Ignore:
Timestamp:
2001-02-01T15:26:44+13:00 (23 years ago)
Author:
paynter
Message:

Named characters like é and ì are translated
to UTF8 internally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/HTMLPlug.pm

    r1844 r1891  
    4040use BasPlug;
    4141use ghtml;
     42use unicode;
    4243use util;
    4344use parsargv;
     
    165166    return 1;
    166167}
     168
     169
     170
    167171
    168172sub replace_images {
     
    520524}
    521525
     526
     527# Extend the BasPlug read_file so that strings like é are
     528# converted to UTF8 internally. 
     529#
     530# We don't convert < or > or & or " in case
     531# they interfere with the GML files
     532
     533sub read_file {
     534    my ($self, $filename, $encoding, $textref) = @_;
     535
     536    &BasPlug::read_file($self, $filename, $encoding, $textref);
     537   
     538    # Convert things like é to their UTF8 equivalents
     539    $$textref =~ s/&(lt|gt|amp|quot);/&z$1;/go;
     540    $$textref =~ s/&([^;]+);/&unicode::ascii2utf8(\&ghtml::getcharequiv($1,1))/gseo;
     541    $$textref =~ s/&z(lt|gt|amp|quot);/&$1;/go;
     542}
     543
    5225441;
Note: See TracChangeset for help on using the changeset viewer.