• 请不要在回答技术问题时复制粘贴 AI 生成的内容
darknoll
V2EX  ›  程序员

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

  •  
  •   darknoll · Dec 21, 2020 · 1866 views
    This topic created in 2000 days ago, the information mentioned may be changed or developed.

    还得自己改下源码编译?

    2 replies    2020-12-21 18:37:52 +08:00
    ysc3839
        1
    ysc3839  
       Dec 21, 2020 via Android
    调用 ServeFile 之前用 w.Header()["Content-Type"] 自己设置一下编码?
    dongya
        2
    dongya  
       Dec 21, 2020
    https://github.com/axgle/mahonia 用这个转一下试试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1628 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 69ms · UTC 16:25 · PVG 00:25 · LAX 09:25 · JFK 12:25
    ♥ Do have faith in what you're doing.