Skip to content

Commit

Permalink
Start to make the wide_ routines more table driven
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jun 14, 2024
1 parent 3705546 commit 1a7715f
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -12689,37 +12689,43 @@ sub wide_to_html
return $string;
}

$string =~ s/\xc2\xa3/£/g;
$string =~ s/\xc2\xa9/©/g;
$string =~ s/\xc2\xae/®/g;
$string =~ s/\xc3\xa1/á/g;
$string =~ s/\xc3\xa2/â/g;
$string =~ s/\xc3\xa4/ä/g;
$string =~ s/\xc3\xa9/é/g;
$string =~ s/\xc3\xad/í/g; # í
$string =~ s/\xc3\xb4/ô/g; # ô
$string =~ s/\xc3\xb6/ö/g;
$string =~ s/\xc5\xa1/š/g;
$string =~ s/\xc4\x8d/č/g;
$string =~ s/\xc5\xbe/ž/g;
$string =~ s/\xc3\xa7/ç/g;
$string =~ s/\xc3\xb3/ó/g;
$string =~ s/\xc3\x96/Ö/g; # Ö
$string =~ s/\xc3\xa8/è/g;
$string =~ s/\xc3\x89/É/g;
$string =~ s/\xc3\x9f/ß/g;
$string =~ s/\xc3\xaa/ê/g;
$string =~ s/\xc3\xab/ë/g;
$string =~ s/\xc3\xae/î/g;
$string =~ s/\xc3\xbb/û/g;
$string =~ s/\xc3\xbc/ü/g; # ü
$string =~ s/\xc5\x9b/ś/g;
$string =~ s/\xc5\xa0/Š/g;
$string =~ s/\xe2\x80\x93/–/g;
$string =~ s/\xc3\xb1/ñ/g; # ñ
$string =~ s/\xe2\x80\x9c/"/g;
$string =~ s/\xe2\x80\x9d/"/g;
$string =~ s/\xe2\x80\xa6/.../g;
my %chars = (
'\xc2\xa3' => '£',
'\xc2\xa9' => '©',
'\xc2\xae' => '®',
'\xc3\xa1' => 'á',
'\xc3\xa2' => 'â',
'\xc3\xa4' => 'ä',
'\xc3\xa9' => 'é',
'\xc3\xad' => 'í', # í
'\xc3\xb4' => 'ô', # ô
'\xc3\xb6' => 'ö',
'\xc5\xa1' => 'š',
'\xc4\x8d' => 'č',
'\xc5\xbe' => 'ž',
'\xc3\xa7' => 'ç',
'\xc3\xb3' => 'ó',
'\xc3\x96' => 'Ö', # Ö
'\xc3\xa8' => 'è',
'\xc3\x89' => 'É',
'\xc3\x9f' => 'ß',
'\xc3\xaa' => 'ê',
'\xc3\xab' => 'ë',
'\xc3\xae' => 'î',
'\xc3\xbb' => 'û',
'\xc3\xbc' => 'ü', # ü
'\xc5\x9b' => 'ś',
'\xc5\xa0' => 'Š',
'\xe2\x80\x93' => '–',
'\xc3\xb1' => 'ñ', # ñ
'\xe2\x80\x9c' => '"',
'\xe2\x80\x9d' => '"',
'\xe2\x80\xa6' => '...',
);

foreach my $char(keys %chars) {
$string =~ s/$char/$chars{$char}/g;
};

$string =~ s/\N{U+00A0}/ /g;
$string =~ s/\N{U+00A3}/£/g,
Expand Down

0 comments on commit 1a7715f

Please sign in to comment.