From b7d70cabd9d223b8736e0877da5b0b0dbfa7b9bc Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Mon, 7 Sep 2009 22:43:49 +0000 Subject: Transliterate to ascii while importing text from the catalogue. git-svn-id: svn://tug.org/texlive/trunk@15176 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TeXCatalogue.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Master/tlpkg/TeXLive') diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm index a634e4d69bc..ad9d83c0ac6 100644 --- a/Master/tlpkg/TeXLive/TeXCatalogue.pm +++ b/Master/tlpkg/TeXLive/TeXCatalogue.pm @@ -10,7 +10,7 @@ use XML::Parser; use XML::XPath; use XML::XPath::XMLParser; -use Encode; +use Text::Unidecode; package TeXLive::TeXCatalogue::Entry; @@ -78,7 +78,9 @@ sub initialize { my $docset = $parser->find('/entry/documentation'); foreach my $node ($docset->get_nodelist) { my $docfile = $parser->find('./@href',$node); - my $details = $parser->find('./@details',$node); + # see comments at end of beautify() + my $details = Text::Unidecode::unidecode( + $parser->find('./@details',$node)); my $language = $parser->find('./@language',$node); $self->{'docs'}{$docfile}{'available'} = 1; if ($details) { $self->{'docs'}{$docfile}{'details'} = $details; } @@ -91,8 +93,9 @@ sub beautify{ $txt =~ s/\n/ /g; $txt =~ s/^[[:space:]]*//g; $txt =~ s/[[:space:]][[:space:]]*/ /g; - # turn of the utf8 flag by encoding it to utf8 - return(Encode::encode("utf-8", $txt)); + # transliterate to ascii: it allows the final tlpdb to be pure ascii, + # avoiding problems since we don't control the user's terminal encoding + return(Text::Unidecode::unidecode($txt)); } sub name { -- cgit v1.2.3