We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

strtolower causes unicode unreadable in PHP + IISRSS

0 replies

Last post May 09, 2017 01:59 AM by it.hieund

  • strtolower causes unicode unreadable in PHP + IIS

    May 09, 2017 01:59 AM|it.hieund|LINK

    Hi MS IIS team,

    We have a PHP app which works well in CentOS.

    Recently, our client want to deploy that app in Windows Server to have better management ability.

    We decided to install PHP 5.4 with IIS, almost are OK except string manipulation functions like strtolower(), strtoupper(), ...

    That functions do not support unicode well so it returns unreadable characters in some special unicode characters like 'à', 'ã', 'ĩ', ...

    The strange thing is it works OK with PHP + Apache in the same machine (Windows Server) so I don't think it's because of PHP, it must be because of IIS configuration or something like that.

    Of course mbstring functions will work in both case but this is not the solution as the app framework already used the basic string manipulation function in thousand places.

    Please see the screenshot: IIS result is in the left and Apache result is in the right

    This is the source code I used to test:

    <html>
    	<head>
    	  <meta charset="UTF-8">
    	</head>
    	<body>
    		<?php
    			$name = 'Cộng Hòa Xã Hội Chủ Nghĩa Việt Nam';
    			
    			echo '$name: '. $name .'<br/>';
    			echo 'strtolower($name): '. strtolower($name) .'<br/>';
    			echo 'mb_strtolower($name, \'UTF-8\'): '. mb_strtolower($name, 'UTF-8') .'<br/>';
    		?>
    	</body>
    </html>
    

    If it's because of the configuration, please give me your suggestion to fix this.

    Otherwise, it may because of IIS which does not support PHP well yet, please fix it in next release soon.

    I appreciate to have your help.

    Thank you very much.