Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
e9926a4c
Commit
e9926a4c
authored
Nov 23, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merged in philip_thiem/setuptools (pull request #26)
SVN Encoding Issues
parents
63f856f5
cc90c509
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
setuptools/svn_utils.py
setuptools/svn_utils.py
+30
-1
No files found.
setuptools/svn_utils.py
View file @
e9926a4c
...
...
@@ -5,6 +5,7 @@ from distutils import log
import
xml.dom.pulldom
import
shlex
import
locale
import
codecs
import
unicodedata
import
warnings
from
setuptools.compat
import
unicode
,
bytes
...
...
@@ -72,6 +73,34 @@ def joinpath(prefix, *suffix):
return
os
.
path
.
join
(
*
suffix
)
return
os
.
path
.
join
(
prefix
,
*
suffix
)
def
determine_console_encoding
():
try
:
#try for the preferred encoding
encoding
=
locale
.
getpreferredencoding
()
#see if the locale.getdefaultlocale returns null
#some versions of python\platforms return US-ASCII
#when it cannot determine an encoding
if
not
encoding
or
encoding
==
"US-ASCII"
:
encoding
=
locale
.
getdefaultlocale
()[
1
]
if
encoding
:
codecs
.
lookup
(
encoding
)
# make sure a lookup error is not made
except
(
locale
.
Error
,
LookupError
):
encoding
=
None
is_osx
=
sys
.
platform
==
"darwin"
if
not
encoding
:
return
[
"US-ASCII"
,
"utf-8"
][
is_osx
]
elif
encoding
.
startswith
(
"mac-"
)
and
is_osx
:
#certain versions of python would return mac-roman as default
#OSX as a left over of earlier mac versions.
return
"utf-8"
else
:
return
encoding
_console_encoding
=
determine_console_encoding
()
def
decode_as_string
(
text
,
encoding
=
None
):
"""
...
...
@@ -87,7 +116,7 @@ def decode_as_string(text, encoding=None):
#text should be a byte string
if
encoding
is
None
:
encoding
=
locale
.
getpreferredencoding
()
encoding
=
_console_encoding
if
not
isinstance
(
text
,
unicode
):
text
=
text
.
decode
(
encoding
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment