cURL / Mailing Lists / curl-library / Single Mail

curl-library

Patch to allow base64 encoding/decoding on non-ASCII platforms.

From: David McCreedy <mccreedytpf_at_msn.com>
Date: Sun, 31 Dec 2006 00:10:18 +0000

This patch allows Base64 encoding/decoding to work on non-ASCII platforms
and mainly affects base64.c and base64.h.

No changes should be seen in the encoded/decoded results on ASCII-based
platforms.

Curl_base64_encode now requires a SessionHandle so it can convert the
to-be-encoded text on non-ASCII platforms.
This extra parameter has been added to all of the Curl_base64_encode calls
in libcurl: http.c, ldap.c, krb4.c, http_digest.c, http_negotiate.c, and
ntlm.c.

On the flip side, Curl_base64_decode's decodeQuantum function uses a new
method of decoding that is character-set independent. This eliminates the
need for conversion when decoding on non-ASCII platforms.

Other conversion-related changes were made to base64.c's test harness that
is compiled if TEST_ENCODE or TEST_DECODE is defined.
This includes fixing a bug in the TEST_DECODE driver that caused it to print
the same, wrong value regardless of the input (lines 154-156 of the diff).
I'm guessing this code hasn't been used in a long time, but I found it
helpful.

Thank you,

-David McCreedy

Received on 2006-12-31