unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* base64-encode-string confusion
@ 2008-08-26 11:17 İsmail Dönmez
  2008-08-26 13:16 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: İsmail Dönmez @ 2008-08-26 11:17 UTC (permalink / raw)
  To: emacs- devel

Hello Emacsers,

http://www.gnu.org/software/emacs/elisp/html_node/Base-64.html
specifically mentions :

<quote>
— Function: base64-encode-string string &optional no-line-break

    This function converts the string string into base 64 code. It
returns a string containing the encoded text. As for
base64-encode-region, *an error is signaled if a character in the
string is multibyte*.
</quote>

Emphasis mine. So essentially it says base64-encode-string will fail
with non-ascii input. But looking at the source code in src/fns.c
function base64_encode_1 has the following signature:

static int
base64_encode_1 (from, to, length, line_break, multibyte)

The last parameter is set to be 1 if the input is multibyte so this
function is supposed to accept multibyte characters it seems. Still at
src/fns.c line 3345 it says :

  encoded_length = base64_encode_1 (SDATA (string),
                                    encoded, length, NILP (no_line_break),
                                    STRING_MULTIBYTE (string));

Looks like STRING_MULTIBYTE macro tries to detect if string is
multibyte or not. So far so good. But trying to base64 encode a
non-ascii character fails :

(base64-encode-string "€") gives

Debugger entered--Lisp error: (error "Multibyte character in data for
base64 encoding")

which is in line with the documentation but doesn't agree with the
code. Am I missing something here?

Regards,
ismail

-- 
Programmer Excuse #26: I suspect it's a bus collision.

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

end of thread, other threads:[~2008-08-26 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 11:17 base64-encode-string confusion İsmail Dönmez
2008-08-26 13:16 ` Andreas Schwab
2008-08-26 13:28   ` İsmail Dönmez
2008-08-26 13:49     ` Stefan Monnier
2008-08-26 15:57       ` İsmail Dönmez

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).