|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-23 20:14 UTC] juan at multiporte dot com dot br
Description:
------------
When using htmlspecialchars with charset UTF-8 in Windows, this not display anything if have special chars. But, if I use utf8_encode function, work nice.
I'm tested in Apache 2.0 and PHP 5.2.5.
Reproduce code:
---------------
<?php
var_dump(htmlspecialchars('mar?o', ENT_QUOTES, 'UTF-8'));
?>
Expected result:
----------------
mar?o (in UTF-8)
Actual result:
--------------
(empty)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 10:00:02 2025 UTC |
Well, I tried using snap version and nothing... Let's go to tecnical infos: PHP Code: <?php var_dump(htmlspecialchars('mar?o', ENT_QUOTES, 'UTF-8')); var_dump(utf8_encode('mar?o')); ?> Result: string(0) "" string(6) "mar?o" PHP version: PHP Version 5.2.6RC3-dev PHP extensions: curl, gd2, gettext, mbstring, mcrypt, mysql, mysqli, openssl, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, soap, sockets, svn, xmlrpc, xsl System: Windows NT ***** 5.1 build 2600 Server API: Apache 2.0 Handler Apache version: Apache/2.0.59 (Win32) PHP/5.2.6RC3-dev SVN/1.4.4 DAV/2 Apache modules: core mod_win32 mpm_winnt http_core mod_so mod_access mod_actions mod_alias mod_asis mod_auth mod_autoindex mod_cgi mod_dav mod_dir mod_env mod_imap mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_rewrite mod_setenvif mod_userdir mod_php5 mod_dav_svn mod_authz_svn [iconv] iconv.input_encoding = ISO-8859-1 iconv.internal_encoding = UTF-8 iconv.output_encoding = UTF-8 Apache configuration (httpd.conf): LoadModule php5_module "c:/arquiv~1/php5/php5apache2.dll" AddType application/x-httpd-php .php AddType application/x-httpd-php .php5 # configure the path to php.ini PHPIniDir "C:/arquiv~1/php5" More information about source file: The source code must be in ANSI mode for see that error. If the source file in UTF-8, work's great.