Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GitCourser opened this issue Apr 21, 2016 · 0 comments
Open

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

GitCourser opened this issue Apr 21, 2016 · 0 comments

Comments

@GitCourser
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant