Re: encode/decode support for base64url
От | Daniel Gustafsson |
---|---|
Тема | Re: encode/decode support for base64url |
Дата | |
Msg-id | B2B7707D-59B5-4253-920D-9F5D66C1AFC1@yesql.se обсуждение исходный текст |
Ответ на | Re: encode/decode support for base64url (Florents Tselai <florents.tselai@gmail.com>) |
Список | pgsql-hackers |
> On 19 Sep 2025, at 08:45, Florents Tselai <florents.tselai@gmail.com> wrote: >> On 19 Sep 2025, at 6:50 AM, Chao Li <li.evan.chao@gmail.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
Вложения
В списке pgsql-hackers по дате отправления: