return result;
}
\f
-/* base64 encode/decode functions.
+/* base64 encode/decode functions (RFC 2045).
Based on code from GNU recode. */
#define MIME_LINE_LENGTH 76
/* The encoding wasn't possible. */
if (length > MAX_ALLOCA)
xfree (encoded);
- error ("Base64 encoding failed");
+ error ("Multibyte character in data for base64 encoding");
}
/* Now we have encoded the region, so we insert the new contents
/* The encoding wasn't possible. */
if (length > MAX_ALLOCA)
xfree (encoded);
- error ("Base64 encoding failed");
+ error ("Multibyte character in data for base64 encoding");
}
encoded_string = make_unibyte_string (encoded, encoded_length);
/* The decoding wasn't possible. */
if (length > MAX_ALLOCA)
xfree (decoded);
- error ("Base64 decoding failed");
+ error ("Invalid base64 data");
}
inserted_chars = decoded_length;
if (length > MAX_ALLOCA)
xfree (decoded);
if (!STRINGP (decoded_string))
- error ("Base64 decoding failed");
+ error ("Invalid base64 data");
return decoded_string;
}