Skip to content

Commit

Permalink
Handle more non-ascii characters
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 1, 2024
1 parent 192aa34 commit b23ecec
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,7 @@ sub print_person
print $index_html '</html>';
close $index_html;
print $csv '1!';
chmod 0444, $index_html;
chmod 0444, $filename;
} else {
if(!-e $filename) {
open(my $index_html, '>', $filename);
Expand All @@ -2222,7 +2222,7 @@ sub print_person
"<body><h1>Family History</h1><a href=\"history.html\">Family History</a></body>";
print $index_html '</html>';
close $index_html;
chmod 0444, $index_html;
chmod 0444, $filename;
}
print $csv '0!';
}
Expand Down Expand Up @@ -5228,7 +5228,7 @@ sub print_person
}

if(($count == 0) || !places_are_the_same({ person => $person, first => $residence, second => $residencelist[$count - 1] })) {
if($birth && $dateofbirth && $rdate && (datecmp($rdate, $dateofbirth) == 0) &&
if($birth && $dateofbirth && $rdate && ($rdate !~ /^\d{3,4}$/) && (datecmp($rdate, $dateofbirth) == 0) &&
places_are_the_same({ person => $person, first => $birth, second => $residence})) {
# This residence record is for the place of birth, which is
# printed elsewhere
Expand Down Expand Up @@ -8365,16 +8365,16 @@ sub print_person
print $html "<li>$f</li>";
print $csv person_line_csv({ person => $father, year => $year });
print $xml "\n\t\t<father>\n\t\t\t<xref>", $father->xref(),
"</xref>\n\t\t\t<first_name>", given_names($father), "</first_name>\n\t\t\t<surname>",
normalize_name($father->surname()), "</surname>\n\t\t</father>";
"</xref>\n\t\t\t<first_name>", wide_to_xml(given_names($father)), "</first_name>\n\t\t\t<surname>",
wide_to_xml(normalize_name($father->surname())), "</surname>\n\t\t</father>";
}
print $csv '!';
if($mother && (my $m = person_line_html({ person => $mother, year => $year }))) {
print $html "<li>$m</li>";
print $csv person_line_csv({ person => $mother, year => $year });
print $xml "\n\t\t<mother>\n\t\t\t<xref>", $mother->xref(),
"</xref>\n\t\t\t<first_name>", given_names($mother), "</first_name>\n\t\t\t<surname>",
normalize_name($mother->surname()), "</surname>\n\t\t</mother>";
"</xref>\n\t\t\t<first_name>", wide_to_xml(given_names($mother)), "</first_name>\n\t\t\t<surname>",
wide_to_xml(normalize_name($mother->surname())), "</surname>\n\t\t</mother>";
}
print $html '</ol>';
} else {
Expand Down Expand Up @@ -14979,7 +14979,7 @@ sub wide_to_html
$string =~ s/\xc3\x81/&Aacute;/g; # Á
$string =~ s/\xc3\x83/&Icirc;/g; # Î
$string =~ s/\xc3\x9e/&THORN;/g; # Þ
$string =~ s/\xc3\xa1/&aacute;/g;
$string =~ s/\xc3\xa1/&aacute;/g; # á
$string =~ s/\xc3\xa2/&acirc;/g;
$string =~ s/\xc3\xa4/&auml;/g;
$string =~ s/\xc3\xa9/&eacute;/g;
Expand Down Expand Up @@ -15030,7 +15030,7 @@ sub wide_to_html
$string =~ s/\N{U+017E}/&zcaron;/g;
$string =~ s/\N{U+00D6}/&Ouml;/g; # Ö
$string =~ s/\N{U+00DF}/&szlig;/g; # ß
$string =~ s/\N{U+00E1}/&aacute;;/g;
$string =~ s/\N{U+00E1}/&aacute;/g;
$string =~ s/\N{U+00E2}/&acirc;/g;
$string =~ s/\N{U+00E4}/&auml;/g;
$string =~ s/\N{U+00E5}/&aring;/g; # å
Expand All @@ -15041,6 +15041,7 @@ sub wide_to_html
$string =~ s/\N{U+00EE}/&icirc;/g;
$string =~ s/\N{U+00EF}/&iuml;/g; # ï
$string =~ s/\N{U+00F0}/&eth;/g; # ð
$string =~ s/\N{U+00F1}/&ntilde;/g; # ñ
$string =~ s/\N{U+00F4}/&ocirc;/g; # ô
$string =~ s/\N{U+00F6}/&ouml;/g;
$string =~ s/\N{U+00F8}/&oslash;/g; # ø
Expand Down Expand Up @@ -15280,11 +15281,11 @@ sub wide_to_xml
$string =~ s/\xc2\xae/&#x0AE;/g;
$string =~ s/\xc3\x81/&#x0C1;/g; # Á
$string =~ s/\xc3\x8e/&#x0CE;/g; # Î
$string =~ s/\xc3\xa1/&#x0E1;/g;
$string =~ s/\xc3\xa1/&#x0E1;/g; # á
$string =~ s/\xc3\xa5/&#x0E5;/g; # å
$string =~ s/\xc3\xa9/&#x0E9;/g;
$string =~ s/\xc3\xaf/&#x0EF;/g; # ï
$string =~ s/\xc3\xb1/&#x0F1;/g; # ntilde
$string =~ s/\xc3\xb1/&#x0F1;/g; # ntilde ñ
$string =~ s/\xc5\xa1/&#x161;/g;
$string =~ s/\xc4\x8d/&#x10D;/g;
$string =~ s/\xc5\xbe/&#x17E;/g; # ž
Expand Down Expand Up @@ -15317,6 +15318,7 @@ sub wide_to_xml
$string =~ s/\xe2\x80\x9d/&quot;/g;
$string =~ s/\xe2\x80\xa6/.../g;
$string =~ s/\xe2\x97\x8f/&#x25CF;/g; # ●
$string =~ s/\xe3\xb1/&#x0F1;/g; # ntilde ñ - what's this one?
# $string =~ s/\xe4\x8d/&#x10D;/g; # ? ACOM strangeness
# $string =~ s/\N{U+0161}/&#x161;/g;
# $string =~ s/\N{U+010D}/&#x10D;/g;
Expand Down Expand Up @@ -15447,6 +15449,10 @@ sub wide_to_xml

# print STDERR __LINE__, ": ($string)\n";
if($string =~ /[^[:ascii:]]/) {
print STDERR (unpack 'H*', $string);
print STDERR __LINE__, ': ';
print STDERR (sprintf '%v02X', $string);
print STDERR "\n";
my $i = 0;
while((my @call_details = caller($i++))) {
print STDERR "\t", colored($call_details[2] . ' of ' . $call_details[1], 'red'), "\n";
Expand Down Expand Up @@ -15682,7 +15688,7 @@ sub dbpedia
}
}
}
warn ">>>>>>>>>> dbpedia allowig possibility $uri" if($opts{'w'});
warn ">>>>>>>>>> dbpedia allowing possibility $uri" if($opts{'w'});
}
}
$Data::Dumper::Maxdepth = 0;
Expand Down

0 comments on commit b23ecec

Please sign in to comment.