The single
quotes are ignored due to the default quote_style setting ENT_COMPAT.
Table 9-2. htmlentities()??™s Supported Character Sets
Character Set Description
BIG5 Traditional Chinese
BIG5-HKSCS BIG5 with additional Hong Kong extensions, traditional Chinese
cp866 DOS-specific Cyrillic character set
cp1251 Windows-specific Cyrillic character set
cp1252 Windows-specific character set for Western Europe
EUC-JP Japanese
GB2312 Simplified Chinese
ISO-8859-1 Western European, Latin-1
ISO-8859-15 Western European, Latin-9
KOI8-R Russian
Shift-JIS Japanese
UTF-8 ASCII-compatible multibyte 8 encode
CHAPTER 9 ?– S TRINGS AND REGULAR EXPRESS IONS 257
Using Special HTML Characters for Other Purposes
Several characters play a dual role in both markup languages and the human language.
When used in the latter fashion, these characters must be converted into their displayable
equivalents. For example, an ampersand must be converted to &, whereas a
greater-than character must be converted to >. The htmlspecialchars() function
can do this for you, converting the following characters into their compatible equivalents.
Its prototype follows:
string htmlspecialchars(string str [, int quote_style [, string charset]])
The list of characters that htmlspecialchars() can convert and their resulting
formats follow:
??? & becomes &
??? " (double quote) becomes "
??? ' (single quote) becomes '
??? < becomes <
??? > becomes >
This function is particularly useful in preventing users from entering HTML markup
into an interactive Web application, such as a message board.
Pages:
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334