Hello,

I just commited a fix for the undefined subroutine error.

Le mercredi 12 juin 2024 à 17:14 +0200, Guillem Jover a écrit :
> > That fixed that issue but then it fails with:
> > 
> >   ,---
> >     PO4A   man.stamp
> >   po4a::pod: The file deb-buildinfo.pod declares utf8 as encoding, but you 
> >              provided UTF-8 as master charset. Please change either
> > setting.
> >    at /usr/bin/po4a line 1663.
> >   make[2]: *** [Makefile:902: man.stamp] Error 255
> >   `---
> 
> I think the charset comparison is too naive though, and does not cover
> for example any aliases listed in «man Encode::Supported». I think a
> better comparison logic could look like this:
> 
>   ,---
>   use Encode;
> 
>   my $enc_charset = Encode::find_encoding($charset);
>   my $enc_master_charset = Encode::find_encoding($master_charset);
> 
>   say 'match' if $enc_charset->mime_name eq $enc_master_charset->mime_name;
>   `---
> 
> Unfortunately neither Encode::find_encoding()->name nor
> Encode::resolve_alias() seem helpful here because they return
> "utf-8-strict" for "UTF-8" which will not match against "utf-8" for
> the canonical "utf8".

The problem is that Perl has a rather unexpected behavior wrt utf8, UTF-8 and
UTF8. These names are not aliases of others in Perl. See
https://perldoc.perl.org/Encode#UTF-8-vs.-utf8-vs.-UTF8

So I don't think that you will find a piece of Perl code that will allow to
merge these names to declare that they are equivalent. In some sense, that's
the essence of all issues I introduced in po4a v0.70 when introducing perlIO to
control the encoding issues. I went from a lax system being utf8 by default but
happily taking latin-1 encoding files to a much stricter UTF-8 system by
default and forcing the user to specify if they want another encoding.

Instead, I just pushed a commit changing the error message when charsets are
utf8 and UTF-8 to insist on the difference between these encodings in Perl.
https://github.com/mquinson/po4a/commit/afe6e1344ffad9d87dd807a81ed6467d6101b15f

Please tell me if it's enough.

> I'm not sure whether lib/Locale/Po4a/Xml.pod might need a similar
> treatment, because that might depend on what encodings are supported
> in there, against what is supported in po4a I guess.

Ah, good catch. I'd have forgotten this one.

Thanks for your help chasing this down,
Mt

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to