Building Chinese Web Sites using PHP
Dr. Herong Yang, Version 2.11

Testing Alt Keycodes with IE on a UTF-8 Web Page

This section provides a test on Latin1 Alt keycodes with Internet Explorer (IE) on a Web page with UTF-8 encoding.

There is no easy way to enter Unicode characters in a Web form, unless you are using a non-English key board, a non-English operating system, or an add-on character input application. But for testing purposes, I tried to enter characters as Latin1 Alt keycodes on a Web page defined as UTF-8 encoding. This Web page was generated by the same PHP script, Web-Form-Input-UTF8-Revised.php, described in the previous section.

1. Start Internet Explorer (IE) with this URL: http://localhost/Web-Form-Input-Revised.php.

2. Press the "num lock" key to turn on "num lock" for the numeric key pad.

3. In the text input box, remove the default text. Now enter <Alt>+0128 by pressing and holding down the Alt key and pressing 0, 1, 2, 8 on the numeric key pad. Release the Alt key. The Euro sign shows up.

4. Repeat the same process to enter four more Alt keycodes: <Alt>+0169, <Alt>+0231, <Alt>+0232, and <Alt>+0233.

5. Click the Submit button. The five special characters shows up on the returning Web page with their Hex number values confirming that the PHP script received them correctly.
Entering UTF-8 Characters with Alt Keycodes

6. Check the page URL in the page address box. The five speical characters are encoded inside the URL: This indicates that IE is smart. It converts the Latin1 character 0x80 (decimal code value 128) to the UTF-8 byte sequence 0xE282.

http://localhost/test.php
  ?Input=%E2%82%AC%C2%A9%C3%A7%C3%A8%C3%A9&Submit=Submit

Conclusion:

  • UTF-8 byte sequence can be displayed correctly on Web pages, if "charset" is provided in the HTML header.
  • There is no easy way to enter UTF-8 byte sequence values in Web form, unless a non-English keyboard is used
  • Some special characters can be entered as Alt keycodes in Latin1 encoding on a Web page with charset=utf-8. IE will do the conversion for you.

Sections in This Chapter

Steps and Components Involved

Processing Web Form Input in ASCII

Processing Web Form Input in Latin1

Entering Latin1 Characters with Alt Keycodes

Testing Latin1 Alt Keycodes with IE

Processing Web Form Input in UTF-8

Outputting Form Default Input Text in UTF-8

Testing Alt Keycodes with IE on a UTF-8 Web Page

Dr. Herong Yang, updated in 2007
Testing Alt Keycodes with IE on a UTF-8 Web Page