1 package SL::DB::Helper::ReplaceSpecialChars;
6 use parent qw(Exporter);
7 our @EXPORT = qw(replace_special_chars);
10 use Text::Unidecode qw(unidecode);
15 sub replace_special_chars {
32 map { $text =~ s/$_/$special_chars{$_}/g; } keys %special_chars;
34 # for all other non ascii chars 'OLÉ S.L.' and 'Årdberg AB'!
35 $text = unidecode($text);
49 SL::DB::Helper::ReplaceSpecialChars - Helper functions for replacing non-ascii characaters
53 use SL::DB::Helper::ReplaceSpecialChars qw(replace_special_chars);
54 my $ansi_string = replace_special_chars("Überhaupt, with Olé \x{5317}\x{4EB0}"); # hint perldoc may already convert
56 # Ueberhaupt, with Ole Bei Jing
62 =item C<replace_special_chars $text>
64 Given a text string this method replaces the most common german umlaute,
65 transforms '&' to '+' and escapes a single quote (').
66 If there are still some non-ascii chars, we use unidecode to guess
67 a sensible ascii presentation, C<perldoc Text::Unidecode>
78 J.Büren (Unidecode added)