SEO Forums















                                          
User   Password   remember     (register)  ?

PHP htmlspecialchars()


Back to php.


thibault    (2009-04-09)

thibault

 
PHP htmlspecialchars()

string htmlspecialchars (string $string [, int $quote_style [, string $charset  [, bool $double_encode]]])


Many HTML character entities must be written in a certain way. This function converts some of these characters. To translate every HTML character entities you may use the htmlentities() function.

This function is particularly useful to avoid that users can post HTML markup in a forum, in this case one it is recommended to use a BBcode-like function that can allow users to type in example [i] instead of <i>.

By using the htmlspecialchars() function

    '&' (ampersand) will become '&amp;'
    '"' (double quote) will become '&quot;' if ENT_NOQUOTES is not set.
    ''' (single quote) will become '&#039;' if ENT_QUOTES is set.
    '<' will become '&lt;'
    '>' will become '&gt;'

The quote_style argument (optional) tells the function what to do with the single and double quote characters. By default the mode is ENT_COMPAT, it only translates the double-quote character, the single-quote remains untranslated. If ENT_QUOTES is set, both single and double quotes are translated, if ENT_NOQUOTES is set neither single nor double quotes are translated.

The charset argument (optional) defines the character set used in conversion. By default the character set is ISO-8859-1 but you may also use these character sets, supported in PHP 4.3.0 and later.

ISO-8859-1  ISO8859-1  Western European, Latin-1
ISO-8859-15 ISO8859-15 Western European, Latin-9.
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 Western European
KOI8-R koi8-ru, koi8r Russian.
BIG5 950 Traditional Chinese (Taiwan).
GB2312 936 Simplified Chinese (National character set).
BIG5-HKSCS   Big5 with Hong Kong extensions, Traditional Chinese.
Shift_JIS SJIS, 932 Japanese
EUC-JP EUCJP Japanese


ficgs
Suggestions

  htmlspecialcharacters help! - PHPBuilder.com
www.phpbuilder.com/board/showthread.php?t=10151060

 Javascript equivalent for PHP's htmlspecialchars
kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_html

 htmlspecialchars - HTML in PHP - Htmlspecialchars PHP
php.about.com/od/phpfunctions/g/htmlspecialchar.htm

 HTML encode string conversion (PHP htmlspecialchars)
www.voormedia.com/en/tools/html-encode-string-conversion-htmlspecialchars.p

 php - htmlspecialchars « php help
phphelper.wordpress.com/php-htmlspecialchars/

 b2evolution :: View topic - [FIXED] Bug in _misc.funcs.php - htmlspecialchars()
forums.b2evolution.net/viewtopic.php?t=5109&sid=a05b2bb2baa39af54ef5cf1



ficgs
More suggestions

This is a collaborative page, you may change the order of these suggestions by registering, then clicking the icons before the titles.


 Rails for PHP Developers - Reference for PHP htmlspecialchars in Ruby
railsforphp.com/reference/strings/htmlspecialchars

 Nabble - Horde - Bugs - [Tickets #7305] broken php htmlspecialchars workaround needed
www.nabble.com/-Tickets--7305--broken-php-htmlspecialchars-workaround-neede

  what is the equivalent in javacript of PHP's htmlspecialchars($str) / htmlspecialchar - Dynamic Drive Forums
www.dynamicdrive.com/forums/showthread.php?t=42659

 php Htmlspecialchars() problem
www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_2343

 php htmlspecialchars() 函数 - 用法|在线手册|属性|方法
www.fzs8.net/php/php_tutorial/2007-03-18/1280.html

 PHP :: Htmlspecialchars Like Magic_quotes?
www.bigresource.com/PHP-htmlspecialchars-like-magic_quotes--BokyyLII.html

 PHP: htmlspecialchars - Manual
algorytmy.pl/doc/php/function.htmlspecialchars.php

  [Tickets #7305] broken php htmlspecialchars workaround needed
lists.horde.org/archives/bugs/Week-of-Mon-20080908/038936.html

 PHP: htmlspecialchars - Manual
jp.php.net/htmlspecialchars

 PHP: htmlspecialchars - Manual
fr.php.net/htmlspecialchars

  PHP, htmlspecialchars(), charset iso-8859-2 not supported
www.freebsd.cz/listserv/archive/users-l/2006q2/016478.html

 PHP : htmlspecialchars - Convert special characters to HTML entities
www.thaicreate.com/php-manual/function.htmlspecialchars.html

 PHP htmlspecialchars() Function
www.kenhmuaban.com/manual/php/func_string_htmlspecialchars.aspx

 PHP "htmlentities()" and "htmlspecialchars()" Buffer Overflows - Secunia Advisories - Vulnerability Information - Secunia.com
secunia.com/advisories/22653/

 Htmlspecialchars to display html tags on page
www.plus2net.com/php_tutorial/htmlspecialchars.php

 Id: edit.php,v 1.8 2009/03/31 20:28:54 agrabs dead $ /** * prints the form to edit the feedback items such moving, deleting and so on * * @version $Id...
cvs.moodle.org/contrib/plugins/mod/feedback/edit.php?view=co

 help writing htmlspecialchars code correctly - ProgrammingTalk
www.programmingtalk.com/showthread.php?t=44626

 [Tickets #7305] broken php htmlspecialchars workaround needed
archives.free.net.ph/message/20080908.145636.b4faf69c.it.html

 CS 85  PHP Programming - Strings
home.earthlink.net/~kengeddes/cs85/lectureNotes/strings.html

 RE: [PHP] htmlspecialchars() - ObjectMix Forum
objectmix.com/php/481243-re-php-htmlspecialchars.html

 Validating PHP forms
myphpform.com/validating-forms.php

 goldvision.net - PHP / htmlspecialchars
www.goldvision.net/us/en/manuals/phpen/function.htmlspecialchars.html

 PHPXRef 0.7 : Mambo 4.6.5 : /administrator/modules/mod_components.php source
mambo-developer.org/api/administrator/modules/mod_components.php.source.htm



Response  
  Smilies

Guest name   (optional)       Register for more options.



Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
  There's no trackback at the moment.









 

FICGS message




SEO forums and chat - Search engines optimization



 
Please download Flash player.
March 18, 2010

 

Buttons: Facebook, Twitter, MySpace, Google, Technorati, Yahoo buzz... Ficgs Facebook Myspace Twitter Google Technorati Stumble upon Delicious Digg Yahoo buzz Wikio Furl Reddit Linkedin Squidoo Newsvine Yahoo My Web Blogmarks Comments Blinklist Email

Write upside down !
(works with Twitter, Facebook, MySpace, Youtube, MSN, Yahoo, Bebo, Hi5...)







FICGS is also a Free Internet Correspondence Games Server.

Here you can play Chess, Go & Poker Texas Holdem online for free in rated class tournaments and a unique world championship.

Free Internet Chess & Go Server


Feel free to link to FICGS :