Skip to content

Instantly share code, notes, and snippets.

@mguillermin
Last active December 28, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mguillermin/7560174 to your computer and use it in GitHub Desktop.
Save mguillermin/7560174 to your computer and use it in GitHub Desktop.
$ php -r "echo htmlentities(htmlspecialchars('œ … ’'));"
œ … ’
$ php test.php
œ … ’
$ php -v
PHP 5.4.21 (cli) (built: Nov 10 2013 14:14:11)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
$ php53 test53.php
$ php53 -v
PHP 5.3.27 (cli) (built: Oct 28 2013 09:19:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
<?php echo htmlentities(htmlspecialchars('œ … ’'));
<?php
// Il faut spécifier l'encoding pour PHP 5.3 (la valeur par défaut n'est pas UTF-8 dans cette version)
echo htmlentities(htmlspecialchars('œ … ’', ENT_COMPAT, 'UTF-8'), ENT_COMPAT, 'UTF-8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment