oozcitak/xmlbuilder-js — pull request #29 by christav (2013-06-08 00:05:28+00:00)
Title: Allow option to include surrogate pairs in XML content

XMLBuilder enforces the rules for valid characters in XML strings. Unfortunately, the Unicode standard has moved on a bit since the XML rules were spec'ed. We've got a need for supporting Asian languages (particularly Chinese) which uses characters that aren't the base multilingual plane (\u0000 - \uFFFF). In 16-bit unicode, these characters are represented by a surrogate pair, two characters in the range \uD800 - \uDFFF. It's not strictly legal XML, but systems that care about Chinese have to be able to produce strings that contain them.

This range of characters is currently blocked by XMLBuilder. This PR adds an option to relax the range checking. I didn't want to change the default behavior, so I made the api look like this:

xmlbuilder.withopts({allowSurrogateChars: true}).create(...)

We're currently using this in the windows azure SDK for node, and need this for Azure China support.