Changeset 1891

Show
Ignore:
Timestamp:
01.02.2001 15:26:44 (19 years ago)
Author:
paynter
Message:

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

Files:
1 modified

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;