Closed
Description
rdflib.plugins.serializers.nt contains a function for encoding unicode characters in XML. It was sourced from http//code.activestate.com/recipes/303668. The code was only intended to be used as a fallback for Python 2.3. Unfortunately, the version of the recipe omits the attempt to use built-in functionality and always falls back on the workaround. The workaround concatenates the output string character and is extremely slow on certain input (long literals in input graph).
The body of the function may be trivially replaced with:
return unicode_data.encode(encoding, 'xmlcharrefreplace')