Building Chinese Web Sites Using PHP - Version 2.20, by Dr. Herong Yang
Copying and Pasting Chinese Input to UTF-8 Web Forms
This section provides a test on copying and pasting Chinese input text from GB18030 and Big5 Web pages to UTF-8 encoded Web forms.
After tried Web form with Chinese input text with 4 different encodings: UTF-8, GB18030, and Big5, I wanted to try to copy and paste Chinese text from one Web page window to another Web page window with a different encoding.
I did the following to copy and pasted Chinese text from GB18030 and Big5 Web pages to a Web form with UTF-8 encoding:
1. Ran IE with this URL: http://localhost/Web-Form-Input-Chinese-UTF8.php, and removed the default text from the input box.
2. Ran another IE window with this URL: http://localhost/Web-Form-Input-Chinese-GB18030.php. Copy and paste the Chinese characters from this page to the input box of the UTF-8 page. The Chinese characters shows up in the input box correctly.
3. Entered a forward slash (/) in the input box of the UTF-8 page.
4. Ran another IE window with this URL: http://localhost/Web-Form-Input-Chinese-Big5.php. Copied and pasted the Chinese characters from this page to the input box of the UTF-8 page. The Chinese characters showed up in the input box correctly.
6. Clicked the Submit button on the UTF-8 page. The pasted characters were received and returned back to the returning Web page. The returned Chinese characters showed up correctly.
The returning page URL also confirmed that Chinese characters were copied and pasted correctly:
http://localhost/Web-Form-Input-Chinese-UTF8.php ?Input=%E7%94%B5%E8%A7%86%E6%9C%BA%2F%E9%9B%BB%E8%A6%96%E6%A9%9F &Submit=Submit
This test shows that IE is smart, it automatically converts the pasted Chinese characters from GB18030 and Big5 encoding to UTF-8 encoding in a Web page form encoded as UTF-8.
Last update: 2015.
Table of Contents