From 9b0f60df93a73e1acb5045c8c85ee54f487dad3d Mon Sep 17 00:00:00 2001 From: cloudaice Date: Fri, 10 May 2013 11:21:33 +0200 Subject: [PATCH] =?UTF-8?q?Catch=E6=98=8E=E7=A1=AE=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jieba/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jieba/__init__.py b/jieba/__init__.py index db29cc3d..aadbe098 100644 --- a/jieba/__init__.py +++ b/jieba/__init__.py @@ -193,7 +193,7 @@ def cut(sentence,cut_all=False): if not isinstance(sentence, unicode): try: sentence = sentence.decode('utf-8') - except: + except UnicodeDecodeError: sentence = sentence.decode('gbk','ignore') re_han, re_skip = re.compile(ur"([\u4E00-\u9FA5a-zA-Z0-9+#&\._]+)"), re.compile(ur"(\s+)") if cut_all: