Skip to content

Fix ascii error when thrift file has chinese chars. - #314

Open
KevinMyDing wants to merge 1 commit into
Thriftpy:developfrom
KevinMyDing:develop
Open

Fix ascii error when thrift file has chinese chars.#314
KevinMyDing wants to merge 1 commit into
Thriftpy:developfrom
KevinMyDing:develop

Conversation

@KevinMyDing

Copy link
Copy Markdown

No description provided.

Comment thread thriftpy/parser/parser.py
data = fh.read()
elif url_scheme == '':
with open(path) as fh:
with open(path, encoding='utf-8') as fh:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py2.7 has no keyword argument encoding. So maybe it's better to read the file in binary mode and decode it to utf-8.

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

Successfully merging this pull request may close these issues.

2 participants