Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Unable to specify encoding #27

@whuizhe

Description

@whuizhe

test = tostring(test01, encoding='utf-8')

encoding='utf-8' is invalid

def tostring(element, encoding=None, method=None, *, short_empty_elements=True):
stream = io.StringIO() if encoding == 'unicode' else io.BytesIO()
ElementTree(element).write(stream, encoding, method=method, short_empty_elements=short_empty_elements)
return stream.getvalue()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions