Convert applicable characters in a String to HTML entities.



  • String subject - The String to convert.
  • Number quotes - How to convert quotes.
    • 0 - Leave quotes unconverted.
    • 1 - Convert single-quotes and leave double-quotes unconverted.
    • 2 (default) - Convert double-quotes and leave single-quotes unconverted.
    • 3 - Convert single-quotes and double-quotes.
  • Boolean all - Whether to convert all possible characters.
    • false - Only ampersands (&), single-quotes ('), double-quotes ("), less than (<), and greater than (>) are converted.
    • true (default) - All characters with HTML entity equivalents are converted.
  • String charset - The character set used in the conversion. The default is ISO-8859-1.


  • String - The converted String.

Returns subject with special characters converted to their HTML entity equivalents.

Supported character sets

Charset Aliases Description
ISO-8859-1 ISO8859-1 Western European, Latin-1
ISO-8859-15 ISO8859-15 Western European, Latin-9. Adds the Euro sign, French and Finnish letters missing in Latin-1(ISO-8859-1)
UTF-8 ASCII compatible multi-byte 8-bit Unicode
cp866 ibm866, 866 DOS-specific Cyrillic charset
cp1251 Windows-1251, win-1251, 1251 Windows-specific Cyrillic charset
cp1252 Windows-1252, 1252 Windows specific charset for Western European
KOI8-R koi8-ru, koi8r Russian
BIG5 950 Traditional Chinese, mainly used in Taiwan
GB2312 936 Simplified Chinese, national standard character set
BIG5-HKSCS Big5 with Hong Kong extensions, Traditional Chinese
Shift_JIS SJIS, 932 Japanese

ptpscript/functions/htmlencode.txt · Last modified: 2007/01/24 10:15
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki