From 3a80c233d52701c594838fc1dd7d8a1424623d4b Mon Sep 17 00:00:00 2001
From: Ricter Z <ricterzheng@gmail.com>
Date: Wed, 19 Oct 2016 22:03:38 +0800
Subject: [PATCH] remove darwin

---
 .travis.yml        | 1 -
 nhentai/cmdline.py | 7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index f4a2beb..983e4eb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
 os:
     - linux
     - windows
-    - darwin
 
 language: python
 python:
diff --git a/nhentai/cmdline.py b/nhentai/cmdline.py
index 41086bf..c10435d 100644
--- a/nhentai/cmdline.py
+++ b/nhentai/cmdline.py
@@ -11,6 +11,9 @@ import nhentai.constant as constant
 from nhentai.utils import urlparse
 from nhentai.logger import logger
 
+reload(sys)
+sys.setdefaultencoding(sys.stdin.encoding)
+
 
 def banner():
     logger.info('''nHentai: あなたも変態。 いいね?
@@ -41,9 +44,11 @@ def cmd_parser():
                       help='use proxy, example: http://127.0.0.1:1080')
 
     try:
-        sys.argv = list(map(lambda x: unicode(x.decode('utf-8')), sys.argv))
+        sys.argv = list(map(lambda x: unicode(x.decode(sys.stdin.encoding)), sys.argv))
     except (NameError, TypeError):
         pass
+    except UnicodeDecodeError:
+        exit(0)
 
     args, _ = parser.parse_args(sys.argv[1:])