How to set PHP socket_write and socket_read character encoding?

I am writing a PHP server, and the client sends data encoded by a specific character. Now I want to tell the server to read and write data in the same character encoding set.

How should I specify a character encoding set for PHP socket_read and socket_write ?

+3
source share
2 answers

These functions pass a string without conversion (i.e., byte by byte), so you cannot set the character encoding. But it also means that you do not need it. You will have the same line on the other hand with the same encoding.

/ mb_convert_encoding().

+2

PHP . , - , , , . - , - (, PHP) .

( )

+1

Source: https://habr.com/ru/post/1715613/


All Articles