wendal / gor

Golang编写的静态博客引擎
599 stars 147 forks source link

site.title 如果设置了中文标题,网页里的导航显示就会乱码 #77

Closed best-apps closed 9 years ago

best-apps commented 9 years ago

site.yml site.title: 静态博客


site.yml 只能保存为ansi格式,如果保存为utf8,compile的时候就会报错。 请问如何解决呢?

wendal commented 9 years ago

https://github.com/wendal/wendal.net/blob/master/site.yml

我用的就是中文,也是utf8,没报错, 把你的报错信息贴出来吧

best-apps commented 9 years ago

gor compile 2014/08/14 12:49:17 gor.go:25: gor ver 3.6.1 2014/08/14 12:49:17 payload.go:31: root= E:\data\static_blog\best-apps-now/ 2014/08/14 12:49:17 payload.go:601: >>> E:\data\static_blog\best-apps-now/themes /twitter/layouts/ 2014/08/14 12:49:17 payload.go:647: Load Layout : default 2014/08/14 12:49:17 payload.go:647: Load Layout : page 2014/08/14 12:49:17 payload.go:647: Load Layout : post 2014/08/14 12:49:17 config.go:46: Look lile a Json, try it 2014/08/14 12:49:17 config.go:49: It is Json Map 2014/08/14 12:49:17 widgets.go:146: Load widget from widgets\analytics/config.y ml 2014/08/14 12:49:17 widgets.go:201: Comments >> disqus 2014/08/14 12:49:17 widgets.go:146: Load widget from widgets\comments/config.ym l 2014/08/14 12:49:17 widgets.go:146: Load widget from widgets\google_prettify/co nfig.yml panic: interface conversion: interface is nil, not string

goroutine 1 [running]: runtime.panic(0x6e94e0, 0xc084093dc0) C:/Users/ADMINI~1/AppData/Local/Temp/2/makerelease250988475/go/src/pkg/r untime/panic.c:266 +0xc8 github.com/wendal/gor.(*RssPlugin).Exec(0xaa4160, 0x2c1a88, 0xc084098ae0) E:/data/static_blog/src/github.com/wendal/gor/plugins.go:53 +0xe7 github.com/wendal/gor.Compile(0xc08400b180, 0x7) E:/data/static_blog/src/github.com/wendal/gor/compile.go:136 +0x1a9b main.main() E:/data/static_blog/src/github.com/wendal/gor/gor/gor.go:70 +0x480

best-apps commented 9 years ago

保存为utf8就报错。 保存为ansi格式就正常。但中文的标题在网页里是乱码的。

best-apps commented 9 years ago

http://best-apps.github.io/

标题 乱码的情况。 aa

best-apps commented 9 years ago

site.yml title : 腾达格尔的博客 tagline: Blog Tagline author : name : TengDaGeEr email : blah@email.test github : username twitter : username feedburner : feedname

navigation :

wendal commented 9 years ago

要不把你开个repo,把网站的源码也上传上来

best-apps commented 9 years ago

https://github.com/best-apps/test_blog

源码放上来了

gor compile gor http 然后 http://127.0.0.1:8080
就能看到标题乱码

演示地址: http://best-apps.github.io/

best-apps commented 9 years ago

截图如下: aa

wendal commented 9 years ago

我测试过了, 用UTF-8 without BOM 是没有问题的, UTF-8 with BOM是会报错.

所以你保存为UTF-8 without BOM 就可以了, notepad++都有这种设置.

wendal commented 9 years ago

有空我去goymal库fix一下

best-apps commented 9 years ago

保存为UTF-8 without BOM 确实可以了

wendal commented 9 years ago

https://github.com/wendal/goyaml2/issues/1