SublimeServer icon indicating copy to clipboard operation
SublimeServer copied to clipboard

关于中文md文件出错的问题

Open GitCourser opened this issue 9 years ago • 0 comments

277 html = TEMPLATE % open(path,"r").read() 包含中文的md文件,gb2312编码的可以直接读,但utf-8编码的会出错,多加个异常处理

        except UnicodeDecodeError:
            html = TEMPLATE % open(path,"r",encoding="UTF-8").read()

287 self.send_header("Content-Length", len(html)) len(html)是没转bytes的长度,英文没问题,中文转换后长度就不够了,网页显示不全,改成len(encoded)

GitCourser avatar Apr 21 '16 13:04 GitCourser