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 · 1427 次点击
    这是一个创建于 1247 天前的主题,其中的信息可能已经有所发展或是发生改变。

    还得自己改下源码编译?

    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   ·   实用小工具   ·   1115 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:06 · PVG 03:06 · LAX 12:06 · JFK 15:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.