$text = 'https://test.com/api/Center/ScanCode/user_id/1/shengle/1.html';
mb_detect_encoding($text)
The printed encoding is ASCII. I want to convert it to utf-8. I have searched many methods but failed
Is there anyone who knows?
Please give me some advice. Thank you! ! !
"Built-in validation reader read \"\" instead of \"https://test.com/api/Center/ScanCode/user_id/1/shengle/1.html\".\r\n Adjust your parameters to increase readability or disable built-in validation.1"
Sorry, I just remembered after seeing the reply. I finally want to solve this problem. In fact, I want to generate a QR code for this link, and occasionally this error will be reported. I will check if it is an encoding problem and want to transfer it. If there is no need to transfer it, In terms of coding, do you know what the problem is?
In fact, it is very simple and cannot be converted because all the contents in your string are in ASCII, so it will be printed out as ASCII, and ASCII is a subset of UTF-8, so there is no need to convert it. You just need to call iconv to convert it and then use mb_detect_encoding. I found it was still ascii. Because in UTF-8, everything that can be represented by the ASCII character set is expressed in ASCII. The same goes for other encodings. ascii encoding is a subset of all other encodings
Is there no expert to answer this question?