Skip to content

nt / nquads serializer has poor workaround for lack of xmlcharrefreplace in py2.3 #680

Closed
@chmod007

Description

@chmod007

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')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions