Currently, the encoding conversions that can be realized in this class library include: Simplified Chinese GB <-> Traditional Chinese BIG5 encoding interchange, Simplified/Traditional Chinese-> Pinyin one-way conversion, Simplified/Traditional Chinese<-> UTF8 encoding conversion, Simplified/Traditional Chinese-> Unicode one-way conversion.
The original author of the class source code is Hessian([email protected]). I merged the original Sample script and modified the class file. I added a parameter to the class constructor so that users can easily set the configuration file path when using it. This way, this class package can be placed in any directory that can be accessed. Otherwise, the file referring to class.Chinese.php in the original version must be in the same directory as class.
The code copy is as follows:
/**
* Chinese encoding collection library
*
* Currently this type of library can be implemented, Simplified Chinese <-> Traditional Chinese encoding interchange, Simplified Chinese, Traditional Chinese-> Pinyin one-way conversion,
* Simplified Chinese, Traditional Chinese<-> UTF8 encoding conversion, Simplified Chinese, Traditional Chinese-> Unicode one-way conversion
*
* @Author Hessian([email protected])
* @version 1.7
* @Copyright Hessian/NETiS
* @Use authorized GPL (cannot be used for any commercial purpose, and the code can be modified without the author's consent, but the modified code must be published in accordance with the GPL protocol)
* @Special thanks to unknown (traditional and simple conversion code snippet)
* @大2003-04-01
* @Last modified 2005-07-26
* @Access public
*
* Update records
*
* ver 1.7 2005-07-26
* Modified the bug caused by the while loop. This bug will handle errors when the last character of the string is "0".
* Affected methods: CHStoUTF8(), CHStoUNICODE()
* (by Zeal Li, http://www.zeali.net/)
*
* ver 1.6 2005-05-16
* The constructor adds a parameter so that the user can easily set the configuration file path when using it
* (by Zeal Li, http://www.zeali.net/)
*
* ver 1.5 2003-06-06
* Added the function of converting UTF8 to GB2312 and BIG5.
*
* ver 1.4 2003-04-07
* Increase the value of charset when converting HTML.
*
* ver 1.3 2003-04-02
* Added the function of converting traditional Chinese to pinyin.
*
* ver 1.2 2003-04-02
* Merge the functions to convert simplified and traditional Chinese to UTF8.
* Modify the function to convert simplified Chinese to pinyin, change the return value to a string, and separate the pinyin of each Chinese character with spaces.
* Added the function of converting simplified Chinese to UNICODE.
* Added the function of converting traditional Chinese to UNICODE.
*
* ver 1.1 2003-04-02
* Added OpenFile() function to support opening local files and remote files.
* Added the function of converting simplified Chinese to UTF8.
* Added the function of converting traditional Chinese to UTF8.
*
* ver 1.0 2003-04-01
* A library that combines Chinese simplified Chinese and traditional Chinese corresponds to various encoding interchange has been initially completed.
*/
Download the full source code package (filesize: 132,522 bytes): Download the source code chinese.rar