Coder Social home page Coder Social logo

发送中文消息乱码了 about gomirai HOT 5 CLOSED

lbx-ai avatar lbx-ai commented on June 28, 2024
发送中文消息乱码了

from gomirai.

Comments (5)

Logiase avatar Logiase commented on June 28, 2024

在headers中加了charset=utf8
应该不会乱码了
(之前忘记了

from gomirai.

lbx-ai avatar lbx-ai commented on June 28, 2024

应该改成
res, err := c.HttpClient.Request().
Path(path).
Method("POST").
Use(body.JSON(data)).
SetHeader("Content-Type", "application/json;charset=utf-8").
Send()
那个body.Json里面没有设置编码

from gomirai.

Logiase avatar Logiase commented on June 28, 2024

已经更新了,感谢

from gomirai.

ssttkkl avatar ssttkkl commented on June 28, 2024

现在还是不行,应该先Use(body.JSON(data))SetHeader("Content-Type", "application/json; charset=UTF-8"),不然Use的时候会自动覆盖掉原来的Header。

from gomirai.

Logiase avatar Logiase commented on June 28, 2024

现在还是不行,应该先Use(body.JSON(data))SetHeader("Content-Type", "application/json; charset=UTF-8"),不然Use的时候会自动覆盖掉原来的Header。

谢谢提醒
(因为我这边默认编码没问题所以没做过测试,添麻烦了,thanks

from gomirai.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.