chrisglass/xhtml2pdf — pull request #116 by donbixler (2013-06-18 15:11:19+00:00)
Title: Multibyte improvements

We have been using xhtml2pdf in our product. It's been working well, but we have been having problems with Asian character sets. In investigating that, I have found the these changes very useful. Note, we have been working most with UTF-8 files, but also with GB-2312 encoding.

1) Using str() on unicode strings that contain multibyte characters
causes errors. Test data type before using str()
2) Can't assume utf-8 encoding for input if another encoding was passed
in. This is only a partial fix for this problem.
3) We have seen identifiers made up of multibyte characters in the CSS
input. Add rudimentary ability to handle them.
4) In our input, about half the functions that use the memoize decorator
eventually will receive an array as a parameter. Hardened the decorator
to handle that case. NOTE: no tests have been run to see if I've killed
the efficiency and thus made the decorator useless.
5) The @font-face construct requires a 'src' parameter. Later code
assumes it's there. Ignore the instance if it doesn't exist.