diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 07:52:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 07:52:47 +0000 |
commit | 2607e6bf533b6bff1a2230feb10df3ee7882d218 (patch) | |
tree | 2e50921735ecab5d889d667c82670a7c386ecff4 /lib/Locale/Po4a/Pod.pm | |
parent | Adding debian version 0.72-1. (diff) | |
download | po4a-2607e6bf533b6bff1a2230feb10df3ee7882d218.tar.xz po4a-2607e6bf533b6bff1a2230feb10df3ee7882d218.zip |
Merging upstream version 0.73.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/Locale/Po4a/Pod.pm')
-rw-r--r-- | lib/Locale/Po4a/Pod.pm | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/Locale/Po4a/Pod.pm b/lib/Locale/Po4a/Pod.pm index 4b3dc04..1933ae3 100644 --- a/lib/Locale/Po4a/Pod.pm +++ b/lib/Locale/Po4a/Pod.pm @@ -27,6 +27,8 @@ use vars qw(@ISA); use Carp qw(croak confess); +use Locale::Po4a::Common; + sub initialize { } sub translate { @@ -84,16 +86,24 @@ sub command { $charset =~ s/^\s*(.*?)\s*$/$1/s; my $master_charset = $self->get_in_charset; - croak wrap_mod( - "po4a::pod", - dgettext( - "po4a", - "The file %s declares %s as encoding, but you provided %s as master charset. Please change either setting." - ), - $self->{DOCPOD}{refname}, - $charset, - $master_charset, - ) if ( length( $master_charset // '' ) > 0 && uc($charset) ne uc($master_charset) ); + + # in POD at least, there is no difference between utf8 and UTF-8. The major POD parsers handle "both encodings" in the exact same way. + # Despite https://perldoc.perl.org/Encode#UTF-8-vs.-utf8-vs.-UTF8 + $master_charset = 'UTF-8' if $master_charset // '' =~ /utf-?8/i; + $charset = 'UTF-8' if $charset =~ /utf-?8/i; + + if ( length( $master_charset // '' ) > 0 && uc($charset) ne uc($master_charset) ) { + croak wrap_mod( + "po4a::pod", + dgettext( + "po4a", + "The file %s declares %s as encoding, but you provided %s as master charset. Please change either setting." + ), + $self->{DOCPOD}{refname}, + $charset, + $master_charset, + ); + } # The =encoding line will be added by docheader } else { |