Thread Problem mit Umlaute bzw. nationale Sonderzeichen (2 answers)
Opened by hehol at 2004-08-18 16:37

ptk
 2004-08-18 18:03
#49354 #49354
User since
2003-11-28
3645 Artikel
ModeratorIn
[default_avatar]
Wenn du kein besseres Modul findest, dann koenntest du mithilfe von charnames und ein bisschen Heuristik eine Ersatzdarstellung finden. Z.B.:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use charnames qw();

my $s = "Müller";
my $t = "";
for my $ch (split //, $s) {
my $ord = ord $ch;
if ($ord > 127) {
my $charname = charnames::viacode($ord);
if ($ord == 223) { # Ausnahme sz
$t .= "ss";
} elsif ($charname =~ /(CAPITAL|SMALL)\s+LETTER\s+(.)/) {
if ($1 eq 'CAPITAL') {
$t .= uc($2);
} else {
$t .= lc($2);
}
} else {
$t .= "?";
}
} else {
$t .= $ch;
}
}
warn $t;

View full thread Problem mit Umlaute bzw. nationale Sonderzeichen