Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brlin-tw opened this issue Aug 11, 2017 · 1 comment

Comments

@brlin-tw
Copy link

$ 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)
@winged
Copy link
Owner

winged commented Aug 25, 2017

Hi, Awesome, I'm glad this is useful for somebody else :)
Sorry for the delay, I was on vacation. Can you upload an example file where it fails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants