From 998184129c6bddd42decb699d3f84a28077fee9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=B3=E4=BF=A1?= Date: Sun, 3 May 2015 11:43:10 +0800 Subject: [PATCH] fix unicode problem, so that it the cheat can display chinese comments --- cheat/sheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheat/sheet.py b/cheat/sheet.py index f2f4e6d..9f9b37d 100644 --- a/cheat/sheet.py +++ b/cheat/sheet.py @@ -4,7 +4,7 @@ from cheat.utils import * import os import shutil import subprocess - +import codecs def copy(current_sheet_path, new_sheet_path): """ Copies a sheet to a new path """ @@ -84,5 +84,5 @@ def read(sheet): if not exists(sheet): die('No cheatsheet found for ' + sheet) - with open (path(sheet)) as cheatfile: + with codecs.open(path(sheet),encoding="UTF-8") as cheatfile: return cheatfile.read()