Skip to content

UnicodeEncodeError occurrs when dealing with an ods spreadsheet with Chinese content #1

Description

@brlin-tw
$ ods2sql.py <test.ods | sqlite3 test.sqlite.db
Traceback (most recent call last):
  File "ods2sql.py", line 288, in <module>
    render(parse(), rowtitles)
  File "ods2sql.py", line 217, in parse
    parser.Parse(xmlstring, True)
  File "ods2sql.py", line 199, in end_element
    self.path[-1].cleanup()
  File "ods2sql.py", line 55, in cleanup
    if isinstance(self[-1], Element) and not self[-1].isempty(): break
  File "ods2sql.py", line 137, in isempty
    return self.content() == ''
  File "ods2sql.py", line 147, in content
    return "".join([repr(x) for x in self.children()])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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