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

encoding not passed to stream #35

Closed
pabloh007 opened this issue May 12, 2017 · 1 comment
Closed

encoding not passed to stream #35

pabloh007 opened this issue May 12, 2017 · 1 comment

Comments

@pabloh007
Copy link

pabloh007 commented May 12, 2017

on line 90 of book.py
file_stream = _convert_content_to_stream(file_content, self._file_type)

does not pass the encoding to use so when decode is used later it throws an decoding exception

it should maybe use the **keywords and pass it to the function like so
file_stream = _convert_content_to_stream(file_content, self._file_type, **keywords)

to maybe something like the below. currently the file_content.decode is set to static 'utf-8'

def _convert_content_to_stream(file_content, file_type, **keywords):
    io = manager.get_io(file_type)
    encoding = keywords.get('encoding', 'utf-8')
    if PY2:
        io.write(file_content)
    else:
        if (isinstance(io, StringIO) and isinstance(file_content, bytes)):
            content = file_content.decode(encoding)
@chfw
Copy link
Member

chfw commented May 18, 2017

Please verify it using pyexcel v0.3.4

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