hexojs / hexo-server

Server module for Hexo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Garbled code will be generated if .md file contains too many Chinese characters

yangg opened this issue · comments

commented

This issue is originally posted at ahonn/hexo-theme-even#46

I have the same problem,
Here is the md file
https://raw.githubusercontent.com/yangg/blog/master/source/_posts/weixin-app.md

Hmmm, definitely an issue. But is it the rendering issue or the server issue?

hexojs/hexo#2171

commented

It renders correct after deploy, so I file the issue here.

mark 遇到同样的问题,好疑惑

Sometimes the 'over-flooded' Chinese characters just get cut out, instead of being replaced by random symbols.

Still got the same result on hexo: 3.3.1 when rendered in the localhost, but it's rendered correctly on github.

It seems that the response is corrupt. The end of response body seems to be truncated and mixed up with some, e.g.:

 <script type="text/javascript" src="/ "undefined" && _ctx.name !== null) ? ((typeof _ctx.name !== "undefined" && _ctx.name !== null) ? _ctx.name : "") : ((typeof name !== "undefined" && name !== null) ? name : "")) !== null ? ((t

It should be something like:

<script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>

instead.

This's actually a regression caused by commit 4103a75.

By enabling the compression can quickly avoid this problem:

server:
  compress: true

The solution of @wayou is actually correct. But the description seems inconsistent with code? disabling or enabling?