RE: Memory requirements of binary data

> -----Original Message-----
> From:	Biron,Paul V [SMTP:Paul.V.Biron@kp.org]
> Sent:	Tuesday, August 15, 2000 10:32 AM
> To:	www-xml-schema-comments@w3.org
> Subject:	RE: Memory requirements of binary data
> 
> > -----Original Message-----
> > From:	Ace [SMTP:Ace@AceProgrammer.com]
> > Sent:	Monday, August 14, 2000 7:45 PM
> > To:	www-xml-schema-comments@w3.org
> > Subject:	Memory requirements of binary data
> > 
> > I have a need to use the binary datatype (encrypting some information in
> > the document). It seems that I can encode binary data in two formats
> (mime
> > and hex). My question is this: How many bits does it take to pass 8 bits
> > of binary data?
> > 
> > I've no experience with the mime type, so I can't even take a guess.
> > In the case of hex, since the byte is translated to two hex characters,
> > does it take 16 or 32 bits (because XML is unicode)?
> > 
> Sorry about not respoding to your earlier message on this subject.
> 
> For hex, each byte of binary data is encoded as two 7bit characters.  For
> base64, the relationship between number of bytes of binary data and number
> of encoded 7bit characters is variable, but as it says in Section 6.8 of
> RFC 2045 (where base64 is defined) [1]:
> 
> 	The encoding and decoding algorithms are simple, but the encoded
> data are consistently only about 33 percent larger than the unencoded
> data. 
> 
> So, in general, I'd say that base64 is more "efficient".
> 
> However, the number of bytes necessary for either encoding is dependent on
> the encoding (e.g., UTF-8 vs. UTF-16) used for the XML entity in question.
> Since both hex and base64 use a restricted subset of ASCII, sending them
> in a UTF-8 encoded XML entity will only require 1 byte for each 7bit
> character. If the XML entity is encoded with UTF-16, then each 7bit
> character will require 2 bytes.
> 
Opps, forgot the reference for base64:

pvb

References
[1] http://www.ietf.org/rfc/rfc2045.txt

Received on Tuesday, 15 August 2000 14:23:25 UTC