PHP implementation of a variety of Chinese code conversion classes to share _javascript skills

Source: Internet
Author: User

At present, this class library can be implemented by the code conversion: Simplified Chinese GB <-> Traditional Chinese BIG5 encoding interchange, simple/Traditional Chinese-> Pinyin one-way conversion, simple/Traditional Chinese <-> UTF8 encoding conversion, simple/Traditional Chinese-> Unicode one-way conversion.

The original author of the class source code is Hessian (solarischan@21cn.com), I merged the original sample script, while modifying the class file, add a parameter for the class constructor so that users can easily set the profile path in use, This allows the class package to be placed in any directory that can be accessed, otherwise the original version references class. chinese.php files must be under the same directory as class.

Copy Code code as follows:

/**
* Chinese Code Collection Class Library
*
* At present, this class library can be implemented, Simplified Chinese <-> Traditional Chinese code 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 (solarischan@21cn.com)
* @ Version 1.7
* @ All rights reserved Hessian/netis
* Use of the authorized GPL (cannot be applied to any commercial use, without the consent of the author to modify the code, but the revised code must be issued under the GPL Agreement)
* @ Special acknowledgements Unknow (simplified conversion code snippet)
* @ starting 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 the error when the last character of the string is "0".
* Affected Method: 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 profile path when used
* (by Zeal Li, http://www.zeali.net/)
*
* Ver 1.5 2003-06-06
* Increase UTF8 conversion to GB2312, BIG5 functions.
*
* Ver 1.4 2003-04-07
* To change the value of charset when the HTML is converted to true.
*
* Ver 1.3 2003-04-02
* To increase the conversion of traditional Chinese to phonetic function.
*
* Ver 1.2 2003-04-02
* Combine simplified and traditional Chinese into UTF8 functions.
* Modify the Simplified Chinese to pinyin function, the return value changed to a string, the pinyin of each Chinese character separated by a space
* To increase the conversion of Simplified Chinese to UNICODE function.
* To increase the conversion of traditional Chinese to UNICODE functionality.
*
* Ver 1.1 2003-04-02
* Add OpenFile () function to support open local and remote files.
* Add Simplified Chinese to UTF8 function.
* Increase the conversion of traditional Chinese to UTF8 function.
*
* Ver 1.0 2003-04-01
* A collection of Chinese Simplified, Chinese traditional corresponding to a variety of code Interchange Class library has been preliminarily completed.
*/

Download full source code package (filesize:132,522 bytes): Download source code Chinese.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.