PHP string Unicode encoding and correct truncation method

When PHP and other languages call each other to transfer data, we often encounter the problem of string coding. For example, I recently developed an RPC service using go language. When PHP is used as the client call, JSON is used for the transmitted object data_ Encode for serialization, Source string: > Test 41 > {"json":['test json te ...

Posted by kaitan on Sat, 18 Dec 2021 16:44:41 +0100

Encoding, garbled, unicode and Emoji

summaryIn various logs and tty output, we can always find various incorrectly encoded characters.�😸� `\xef\xbf\xbd\xf0\x9f\x98\xb8\xef\xbf\xbd` '\xe7\xb2\xbe\xe5\xa6\x99' `<<"你好">>`In this case, we subconsciously have three ideas:What is this (what should be the original content)?Where did you come from?Why is that?What should ...

Posted by tomharding on Thu, 09 Dec 2021 05:11:37 +0100