Re: Incorrect title and footer encoding for de_DE locale

Reuben Thomas <[email protected]> Wed, 20 Mar 2024 17:11:08 +0100
Newsgroups gmane.comp.printing.a2ps.bugs
Message-ID <CAOnWdoia5vNWZB708Bb8U72rmcpK4ARORu=NjAe7kavi1+8+fw@mail.gmail.com>
--00000000000063c591061419d783
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, 20 Mar 2024 at 14:59, Stefan <[email protected]> wrote:

>
> If a2ps itself has support for localization, id est providing headers
> and footers in the locale configured by the user, as it currently is,
> I expect these values to use the proper encoding.


It's true that I cannot see anywhere in the code or documentation that the
encoding of the localized time is dealt with. I guess the assumption is
that your output encoding will match your locale. Since a2ps does not
support UTF-8, that can't happen in your case. So, you have to change the
locale.

Or, you could use paps, which does support UTF-8:
https://github.com/dov/paps

at the moment. a2ps just uses the current locale and writes the header
> and footer into the Postscript file directly if headers are enabled
> (what I want).


a2ps will re-encode text when you tell it that the input is in a particular
encoding and the output is in a different encoding. For example:

echo "=C3=A9crit" |recode utf8..CP-850 | faketime "2023-02-24" a2ps --encod=
ing
IBM-CP850 -o foo.ps

then the date comes out as "fM-ivr." Here, the "=C3=A9" has been treated as
non-printable, presumably because a2ps's encoding routines are not clever
enough to map it from one encoding to the other.

It is unlikely that a2ps as it stands will ever be fixed to understand
multibyte encodings; I have however suggested how current packages could be
combined to make a replacement: https://savannah.gnu.org/task/?16517

Meanwhile, feel free to file a bug about a2ps's failure to check the
encoding of the locale. However, fixing that bug would not help you; the
best case is that a2ps would simply issue a warning or refuse to run in a
UTF-8 locale.

--=20
https://rrt.sc3d.org

--00000000000063c591061419d783
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail=
_attr">On Wed, 20 Mar 2024 at 14:59, Stefan &lt;<a href=3D"mailto:stefan641=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex"><br>
If a2ps itself has support for localization, id est providing headers<br>
and footers in the locale configured by the user, as it currently is,<br>
I expect these values to use the proper encoding.</blockquote><div><br><div=
 style=3D"font-family:arial,helvetica,sans-serif;font-size:small" class=3D"=
gmail_default">It&#39;s
 true that I cannot see anywhere in the code or documentation that the=20
encoding of the localized time is dealt with. I guess the assumption is=20
that your output encoding will match your locale. Since a2ps does not suppo=
rt UTF-8, that can&#39;t happen in your case. So, you have to change the lo=
cale.<br></div></div><div><br></div><div><div style=3D"font-family:arial,he=
lvetica,sans-serif;font-size:small" class=3D"gmail_default">Or, you could u=
se paps, which does support UTF-8: <a href=3D"https://github.com/dov/paps">=
https://github.com/dov/paps</a></div><br></div><blockquote class=3D"gmail_q=
uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2=
04);padding-left:1ex">at the moment. a2ps just uses the current locale and =
writes the header<br>
and footer into the Postscript file directly if headers are enabled<br>
(what I want).</blockquote><div><br></div><div><div style=3D"font-family:ar=
ial,helvetica,sans-serif;font-size:small" class=3D"gmail_default">a2ps will=
 re-encode text when you tell it that the input is in a particular encoding=
 and the output is in a different encoding. For example:<br></div><div styl=
e=3D"font-family:arial,helvetica,sans-serif;font-size:small" class=3D"gmail=
_default"><br>echo &quot;=C3=A9crit&quot; |recode utf8..CP-850 | faketime &=
quot;2023-02-24&quot; a2ps --encoding IBM-CP850 -o <a href=3D"http://foo.ps=
">foo.ps</a></div></div></div><div class=3D"gmail_quote"><br></div><div cla=
ss=3D"gmail_quote"><div style=3D"font-family:arial,helvetica,sans-serif;fon=
t-size:small" class=3D"gmail_default">then the date comes out as &quot;fM-i=
vr.&quot; Here, the &quot;=C3=A9&quot; has been treated as non-printable, p=
resumably because a2ps&#39;s encoding routines are not clever enough to map=
 it from one encoding to the other.<br></div></div><div class=3D"gmail_quot=
e"><br></div><div class=3D"gmail_quote"><div style=3D"font-family:arial,hel=
vetica,sans-serif;font-size:small" class=3D"gmail_default">It is unlikely t=
hat a2ps as it stands will ever be fixed to understand multibyte encodings;=
 I have however suggested how current packages could be combined to make a =
replacement: <a href=3D"https://savannah.gnu.org/task/?16517">https://savan=
nah.gnu.org/task/?16517</a></div><div style=3D"font-family:arial,helvetica,=
sans-serif;font-size:small" class=3D"gmail_default"><br></div><div style=3D=
"font-family:arial,helvetica,sans-serif;font-size:small" class=3D"gmail_def=
ault">Meanwhile, feel free to file a bug about a2ps&#39;s failure to check =
the encoding of the locale. However, fixing that bug would not help you; th=
e best case is that a2ps would simply issue a warning or refuse to run in a=
 UTF-8 locale.<br></div></div><div class=3D"gmail_quote"><br></div><span cl=
ass=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmai=
l_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><a href=3D"https://rrt.=
sc3d.org" target=3D"_blank">https://rrt.sc3d.org</a></div></div></div></div=
></div>

--00000000000063c591061419d783--