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

Added encoding to open file - #12

Open
screendriver wants to merge 2 commits into
openlabs:masterfrom
screendriver:encoding
Open

Added encoding to open file#12
screendriver wants to merge 2 commits into
openlabs:masterfrom
screendriver:encoding

Conversation

@screendriver

Copy link
Copy Markdown
Contributor

On Windows machines your package can not be installed via pip, so I added utf-8 encoding:

File"C:\Users\me\AppData\Local\Temp\foo-packaging587492447920215615.tmp\microsofttranslator\setup.py", line34, inreadreturnopen(os.path.join(os.path.dirname(__file__), fname)).read()
File"C:\Python34\lib\encodings\cp1252.py", line23, indecodereturncodecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap'codeccan'tdecodebyte0x9dinposition1377: charactermapsto<undefined>

@screendriver

Copy link
Copy Markdown
ContributorAuthor

Hmm it seems that the keyword argument "encoding" is not supported in Python 2.7. Is there a workaround for that?

@sharoonthomas

Copy link
Copy Markdown
Contributor

@bbqrob

Copy link
Copy Markdown

Successfully tested on Windows 8.1 with Python 3.4

@screendriver

Copy link
Copy Markdown
ContributorAuthor

Another solution where you don't have to change anything in your Python code: simple replace "Olá" with "Ola" 😉

@sharoonthomas

Copy link
Copy Markdown
Contributor

@screendriver wouldn't that be ironic given what we are all trying to do is translate between languages :)

@screendriver

Copy link
Copy Markdown
ContributorAuthor

That's true. But look at @rob19780114 s post. It seems to work with the codec Python module.

@bbqrob

Copy link
Copy Markdown

@sharoonthomas Actually it's not a problem supplying à, but please set the correct encoding, if you do so. :)

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@screendriver@sharoonthomas@bbqrob