In Base 64 encoding, there are only 64 characters used per octet (not
counting white space and other things that don't count). That gives you 6
bits of encoded material. The only way to encode 24 bits of material (3
full octets) is with 4 Base 64 characters. You will always use 4 octets to
encode 3.
The whole reason for this is to be able to use a channel that will likely
preserve those 64 different character encodings, in traveling end-to-end,
without loss or disruption. That's the price. The machine and operating
system you are on has nothing to do with it.
-- orcmid
"wenmang" <we*****@yahoo.com> wrote in message
news:9f**************************@posting.google.c om...
"Dennis E. Hamilton" <de*************@acm.org> wrote in message
news:<82******************************@news.terane ws.com>...
By my math, you will use 32 bits for every 24 encoded (4 base64
characters (bytes) for 3 octets (bytes) worth of bits, or exactly 1-1/3 times the
space required for the raw bits.
I am on HPUX11, could I use 4 base64 chars to encode 4 octets? is this
doable or 1-1/3 ratio is always the case?
Since there's no commonly-available, safe alternative for carrying
binary data in XML elements, I suppose you should be asking "drawback relative
to what?"
I use a wrong word, I should ask "is the price to pay for encoding the
binary content?"
I am wondering whether 1 to 1 byte to byte encoding is possbile using
base64 for binary encoding without incurring the increasing in size?
(If the binary is compressible, you might do that before Base64
encoding. But that adds more to what the recipient is required to do.)
-- orcmid