Automatic detection of text file coding
In various applications, text files from different sources are inevitable. Because the code page is not compatible, it may lead to potential errors. This article explores the automatic detection text file code page to reduce the challenge of such problems.
Although the DETECTENCODINGFROMBYTEORDERLKS method of the StreamReader constructed function can detect common code pages such as IBM850 and Windows1252 with UNICODE labels.
One way to solve this detection limit is to use artificial assistance.
Artificial auxiliary detection scheme:
Check the documents in the Notepad, identify garbled text, and infer the language according to the known character.
The above is the detailed content of How Can We Automatically Detect Text File Encoding, Especially for Code Pages Like IBM850 and Windows-1252?. For more information, please follow other related articles on the PHP Chinese website!