PHP Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 2.21

Handling Non ASCII Characters - Overview

Part:   1  2  3 

PHP Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

Non ASCII Characters with MySQL

Inputting Non ASCII Characters

Controlling Response Header Lines

HTTP Request Variables

Sessions

Using Cookies

PHP SOAP Extension

PHP SOAP Extension - Server

Directories, Files and Images

Using MySQL with PHP

... Table of Contents

(Continued from previous part...)

ASCII Characters in PHP Pages

As I mentioned earlier, ASCII characters can travel from PHP files to browsers easily without any trouble. Here is a simple PHP file with ASCII characters only:

<?php #HelpASCII.php
# Copyright (c) 2005 by Dr. Herong Yang, http://www.herongyang.com/
#
   print("<html><body>\n");
   print("<b>Help</b><br/>\n");
   print("This is a very simple help page...<br/>\n");
?>
This is a very simple help page...<br/>
</body></html>

If you view this page with a browser, you will get the following output:

Help
This is a very simple help page...
This is a very simple help page...

Perfect, right? ASCII text entered as a PHP string literal travels through correctly. Text entered as HTML static text outside the PHP block travels through also correctly.

Conclusion

  • In a Web application, characters must travel through different paths involving a number of programs and systems.
  • ASCII characters have no problems to travel through different programs and systems.
  • Non ASCII characters must be encoded into a safe format to travel through different programs and systems.
  • Tutorial notes are provided in the next 5 chapters for handling non ASCII characters in different areas: HTML documents, PHP string literals, HTML input forms, PHP string functions, and MySQL databases.

Part:   1  2  3 

Dr. Herong Yang, updated in 2006
PHP Tutorials - Herong's Tutorial Notes - Handling Non ASCII Characters - Overview