Closed dockfries closed 1 year ago
If you using windows system and there is garbled code when the terminal displays pino
logger, you can run the server with the following command.
cmd /c "chcp 65001 > nul & omp-server"
in powershell or cmd, which launches a cmd window and temporarily sets the charset to utf8.
for powershell
, please add $PROFILE
for persistence
# $OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding
Usually, the dev/serve
of the terminal under vscode
will not garble, because the vscode sets the terminal to be utf8 encoded, so the display is normal.
Although it is more recommended to run directly on linux systems.
Principle
The current situation is that the player chooses the interface language and the system character set on his own, because for sa:mp windows the character set is ansi, depending on the different regions.
The server-side texts are all utf8, and when transmitting to the player, the utf8 is converted into an array of decimal bytes for transmission with the character set chosen by the player.
When the player transmits text data to the server, custom events are also defined by polyfill (see gamemode for details) and passed to the server as decimal byte arrays, which are decoded to utf8 by the server according to the character set chosen by the player.
By now a two-way closed-loop internationalized data transfer has been achieved.
Nickname
See gamemode and dockfries/omp-node#14 for support for multi-byte nicknames.
Note
It is worth noting that: