mirror of
https://github.com/vinta/awesome-python.git
synced 2026-03-25 20:44:03 -05:00
[PR #280] [CLOSED] Specify encoding explicitly #260
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vinta/awesome-python/pull/280
Author: @myd7349
Created: 12/9/2014
Status: ❌ Closed
Base:
master← Head:master📝 Commits (1)
0ce698cSpecify encoding explicitly📊 Changes
1 file changed (+7 additions, -2 deletions)
View changed files
📝
sort.py(+7 -2)📄 Description
Since the default system encoding of my Win7 x64(simplified Chinese) is not utf-8, but GBK; sort.py doesn't work in Python 3.4.2.
The traceback message is:
So I just specify the encoding explicitly by passing the keyword argument 'encoding'. (Otherwise, Python 3.x will use the system's default encoding.)
The builtin 'open' function in Python 2.7.8 doesn't provide such a parameter, however. So I use codecs.open instead.
The modified version has already been tested on Win7 x64 with both Python 2.7.8 and Python 3.4.2.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.