O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Item 19. Encode Binary Data Using Quoted Printable and/or Base64

It's questionable whether including binary data in XML documents is a good idea at all. You're often better off just pointing to it with a URL. However, if you do have a genuine need to keep binary information together with text in one document, there are a number of straight forward algorithms for encoding arbitrary byte sequences as text. These include the following:

  • UUEncode

  • hexBinary

  • Quoted printable

  • Base64

Only the last two are worth considering. UUEncode is not precisely defined and varies significantly in practice between different implementations. hexBinary is simple to implement, but it at least doubles the size of every file. Quoted printable and Base64 are much more efficient. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required