unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52670: legacy base64 encoding of latin-1
@ 2021-12-19 21:47 mattiase
  2021-12-20 17:26 ` bug#52670: [PATCH] " mattiase
  0 siblings, 1 reply; 4+ messages in thread
From: mattiase @ 2021-12-19 21:47 UTC (permalink / raw)
  To: 52670

For what appears to be historical reasons, the base64 encoding functions (base64-encode-string etc) treat characters in the range U+0080..U+00FF as if they were raw bytes in the 127..255 range. This means that

  (base64-encode-string "ÿ")

and

  (base64-encode-string "\xff")

return the same result although the strings are completely different. Attempts to encode other multibyte characters fail (correctly). For example,

  (base64-encode-string "Ÿ")

signals an error, as expected.

I propose we tighten up the behavior by eliminating the legacy handling of characters in the  U+0080..U+00FF range. Letting the bug stay in place enables incorrect, brittle and error-prone usage: the functions are clearly intended to be fed encoded text only and should signal an error when not, as stated in the manual.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-20 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-19 21:47 bug#52670: legacy base64 encoding of latin-1 mattiase
2021-12-20 17:26 ` bug#52670: [PATCH] " mattiase
2021-12-20 19:10   ` Eli Zaretskii
2021-12-20 19:24     ` Mattias Engdegård

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).