How to modify socket.io Encoding

in the socket project, it is found that the cookie of the page obtained by socket.io is garbled, but the http request is normal.
after studying the request, it is found that the page encoding is different from that of the socket server, as shown in figure

find the answer in stackoverflow and decode it directly with utf8.
https://stackoverflow.com/que.

const utf8 = require("utf8");
utf8.decode(string);   //utf8

the previous idea was wrong, thinking that the encoding mode should be set in the socket.io server configuration to achieve page and server coding consistency.

Apr.23,2021

request a content-type header

Menu