From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Florents Tselai <florents(dot)tselai(at)gmail(dot)com> |
Cc: | "Chao (Evan) Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Aleksander Alekseev <aleksander(at)tigerdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, Przemysław Sztoch <przemyslaw(at)sztoch(dot)pl> |
Subject: | Re: encode/decode support for base64url |
Date: | 2025-09-19 07:16:35 |
Message-ID: | B2B7707D-59B5-4253-920D-9F5D66C1AFC1@yesql.se |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On 19 Sep 2025, at 08:45, Florents Tselai <florents(dot)tselai(at)gmail(dot)com> wrote:
>> On 19 Sep 2025, at 6:50 AM, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> It’s not common to use two white-spaces after “.”, usually we need only one.
>
> I agree with this
This might date me (and others) but double-space after period was the norm for
monospaced typesetting back in the clackety-clack typewriter days, and that
carried over into monospace font text in computers. The fmt program still use
double-space after period (which is what formatted my reply here, thus the use
of double-space in my emails). While there is no hard rule in postgres
(AFAIK), a quick regex shows that it's 2.5x more common for sentences in
comments to have two space after punctuation.
>> The comment is understandable, but slightly vague: remainder of what?
>>
>> Maybe rephrase to “handle remaining bytes in buf”.
>
> Agree too.
I don't think the comment was all that vague in the context of reading the
code, but expanding won't hurt so done.
>> ereport(ERROR,
>> (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
>> - errmsg("unexpected \"=\" while decoding base64 sequence")));
>> + errmsg("unexpected \"=\" while decoding %s sequence", url ? "base64url" : "base64")));
>> ```
>>
>> This is a normal usage that injects sub-strings based on condition. However, PG doesn’t like that, see here: https://www.postgresql.org/docs/devel/nls-programmer.html#NLS-GUIDELINES
>
> Well, that’s a very interesting catch.
> I’ll let a comitter confirm & advise.
Yes and no, the recommendation against constructing sentences at runtime is to
aid translators since the injected string isn't available to them. In this
(and I hope all other) case the injected string should not be translated as it
is a name of an encoding scheme. What we can do is to add a /* translator: ..
*/ comment which will end up in the translation file and give the translator
context on what %s will be replaced by. Done in the attached.
--
Daniel Gustafsson
Attachment | Content-Type | Size |
---|---|---|
v10-0001-Add-support-for-base64url-encoding-and-decoding.patch | application/octet-stream | 15.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2025-09-19 07:37:46 | Re: _CRT_glob stuff |
Previous Message | Frédéric Yhuel | 2025-09-19 07:06:49 | Re: [BUG] temporary file usage report with extended protocol and unnamed portals |