User's Manual

Encoding HTML Pages
8-4 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
Encoding HTML Pages
The encoding of an HTML page is important information for a browser and an
Internet application. You can think of the page encoding as the character set used for
the locale that an Internet application is serving. The browser needs to know about the
page encoding so that it can use the correct fonts and character set mapping tables to
display the HTML pages. Internet applications need to know about the HTML page
encoding so they can process input data from an HTML form.
Instead of using different native encodings for the different locales, it is recommended
to use UTF-8 (Unicode encoding) for all page encodings. Using the UTF-8 encoding
not only simplifies the coding for global applications, but it allows for multilingual
content on a single page.
Specifying the Page Encoding for HTML Pages
There are two ways to specify the encoding of an HTML page, one is in the HTTP
header, and the other is in the HTML page header.
Specifying the Encoding in the HTTP Header
Include the Content-Type HTTP header in the HTTP specification. It specifies the
content type and character set. The Content-Type HTTP header has the following
form:
Content-Type: text/html; charset=utf-8
The charset parameter specifies the encoding for the HTML page. The possible values
for the charset parameter are the IANA names for the character encodings that the
browser supports.
Specifying the Encoding in the HTML Page Header
Use this method primarily for static HTML pages. Specify the character encoding in
the HTML header as follows:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
The charset parameter specifies the encoding for the HTML page. As with the
Content-Type HTTP Header, the possible values for the charset parameter are the
IANA names for the character encodings that the browser supports.
Specifying the Page Encoding in PHP
You can specify the encoding of an HTML page in the Content-Type HTTP header in
PHP by setting the default_charset configuration variable as follows:
default_charset = UTF-8
This can be found in the Zend Core for Oracle Console in the Configuration tab.
Choose the PHP sub-tab and expand the Data Handling tree control. After entering a
value, save the configuration settings and restart the web server.
Portuguese pt PORTUGUESE PORTUGAL
Spanish es SPANISH SPAIN
Table 8–1 (Cont.) Locale Representations in ISO, SQL and PL/SQL Programming
Locale Locale ID NLS_LANGUAGE NLS_TERRITORY