PHP Tutorials - Herong's Tutorial Examples - v5.17, by Herong Yang
Character String Traveling Paths
This section describes steps of connection paths that character strings must travel through in a typical Web based application: output characters strings come from PHP files or data base tables and input character strings come from user's Web browser.
In a typical Web based application, character strings will travel from one part of the application to another part. Here are some possible paths character strings may travel through.
From PHP file to Web browser: The following diagram illustrates steps that character strings must travel through from a PHP file to a browser screen. It also shows the computing technologies that are used at different steps:
A1. Key Sequences from keyboard | |- Text editor v A2. PHP File | |- PHP CGI engine v A3. HTML Document | |- Web server v A4. HTTP Response | |- Internet TCP/IP Connection v A5. HTTP Response | |- Web browser v A6. Visual characters on the screen
From Database to Web browser: The following diagram illustrates steps that character strings must travel through from a database table to a browser screen. It also shows computing technologies that are used at different steps:
B1. Byte sequences in storage | |- Database server v B2. Byte stream | |- Database connection driver v B3. Byte stream | |- PHP Application v B4. HTTP Response | |- Internet TCP/IP Connection v B5. HTTP Response | |- Web browser v B6. Visual characters on the Screen
From Web browser to Database: The following diagram illustrates steps that character strings must travel from a Web browser to a database table. It also shows computing technologies that are used at different steps:
C1. Key sequences on keyboard | |- Language input tool (optional) v C2. Byte sequences | |- Browser input form v C3: HTTP request | |- Internet TCP/IP Connection v C4. HTTP request | |- Web server v C5. CGI variables and input stream | |- PHP Application v C6. PHP variables | |- Database connection driver v C7. Byte stream | |- Database server v C8. Byte sequence in storage
Since all computing technologies are using ASCII encoding by default, text of ASCII characters can safely travel through those steps without any issues.
However, for non ASCII characters, we have to watch out each steps carefully to make sure that characters are not damaged and are encoded and decoded correctly.
Now I will try to provide some tutorials in this chapter and next 5 chapters to show you how to handle characters correctly in different steps of different connection paths.
Table of Contents
Introduction and Installation of PHP
PHP Data Types and Data Literals
Variables, References, and Constants
Expressions, Operations and Type Conversions
Conditional Statements - "if" and "switch"
Loop Statements - "while", "for", and "do ... while"
Function Declaration, Arguments, and Return Values
Interface with Operating System
Introduction of Class and Object
Integrating PHP with Apache Web Server
Retrieving Information from HTTP Requests
Creating and Managing Sessions in PHP Scripts
Sending and Receiving Cookies in PHP Scripts
Controlling HTTP Response Header Lines in PHP Scripts
MySQL Server Connection and Access Functions
Functions to Manage Directories, Files and Images
SOAP Extension Function and Calling Web Services
SOAP Server Functions and Examples
►Localization Overview of Web Applications
What Is Localization / Internationalization
Localization of Web Based Applications
►Character String Traveling Paths
Output ASCII Character Strings from PHP Scripts
Using Non-ASCII Characters in HTML Documents
Using Non-ASCII Characters as PHP Script String Literals
Receiving Non-ASCII Characters from Input Forms
"mbstring" Extension and Non-ASCII Encoding Management
Managing Non-ASCII Character Strings with MySQL Servers
Parsing and Managing HTML Documents
Configuring and Sending Out Emails
Managing PHP Engine and Modules on macOS