emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

base64-encode-string confusion


From: İsmail Dönmez
Subject: base64-encode-string confusion
Date: Tue, 26 Aug 2008 14:17:15 +0300

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]