diff options
| author | 2011-12-14 16:18:30 +0100 | |
|---|---|---|
| committer | 2011-12-14 16:18:30 +0100 | |
| commit | 2ed683d477a547dcab2a554d0a1e95e3f4a35d48 (patch) | |
| tree | 8dafe6796dcbba5c8a2aca99a0dc35deaf8d9ad8 /module | |
| parent | fix input encoding in setup (diff) | |
| download | pyload-2ed683d477a547dcab2a554d0a1e95e3f4a35d48.tar.xz | |
cp65001 is broken
Diffstat (limited to 'module')
| -rw-r--r-- | module/Utils.py | 10 | ||||
| -rw-r--r-- | module/setup.py | 6 | 
2 files changed, 12 insertions, 4 deletions
| diff --git a/module/Utils.py b/module/Utils.py index 1f4f8c047..9c0856e2a 100644 --- a/module/Utils.py +++ b/module/Utils.py @@ -61,6 +61,16 @@ if sys.getfilesystemencoding() == 'ANSI_X3.4-1968':  else:      fs_encode = fs_decode = lambda x: x  # do nothing +def getConsoleEncoding(enc):    +    if os.name == "nt":  +        if enc == "cp65001": # aka UTF-8 +            print "ERROR: Windows codepage 65001 is not supported." +            exit()     +    elif enc == "ascii":  +            print "WARNING: Your console's encoding was identified as ASCII. Forcing UTF-8 instead." +            enc = "UTF-8"     +     +    return enc  def compare_time(start, end):      start = map(int, start) diff --git a/module/setup.py b/module/setup.py index 243758ff4..0e8b54848 100644 --- a/module/setup.py +++ b/module/setup.py @@ -28,6 +28,7 @@ from subprocess import PIPE  from subprocess import call  import sys  from sys import exit +from module.utils import getConsoleEncoding  class Setup():      """ @@ -37,10 +38,7 @@ class Setup():      def __init__(self, path, config):          self.path = path          self.config = config -        self.stdin_encoding = sys.stdin.encoding -        if self.stdin_encoding == "ascii": -            self.stdin_encoding = 'utf_8' -            print "Your terminal encoding was identified as ASCII. Forcing UTF-8." +        self.stdin_encoding = getConsoleEncoding(sys.stdin.encoding)      def start(self):          langs = self.config.getMetaData("general", "language")["type"].split(";") | 
