V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
darknoll
V2EX  ›  程序员

go 的 http.ServeFile 就只支持 utf-8/utf-16be/utf-16le?怎么把 gb2312 编码的文件返回?

  •  
  •   darknoll · 2020-12-21 14:54:22 +08:00 · 1423 次点击
    这是一个创建于 1230 天前的主题,其中的信息可能已经有所发展或是发生改变。

    还得自己改下源码编译?

    2 条回复    2020-12-21 18:37:52 +08:00
    ysc3839
        1
    ysc3839  
       2020-12-21 15:20:09 +08:00 via Android
    调用 ServeFile 之前用 w.Header()["Content-Type"] 自己设置一下编码?
    dongya
        2
    dongya  
       2020-12-21 18:37:52 +08:00
    https://github.com/axgle/mahonia 用这个转一下试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1063 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:17 · PVG 02:17 · LAX 11:17 · JFK 14:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.