PHP CLI with unicode

Last week , I wrote Zawgyi to Unicode PHP converter at the plane. I got a problem. All of Myanmar Unicode can’t convert or echo. It was show ???? instead of characters. I can’t connect internet. I can’t use Google. I don’t know why. I thought PHP CLI may not support UTF-8. It was not possible. I got a idea. Yes, need to check in php.ini. PHP CLI and php from web are not same ini file. So, I need to check php.ini path from cli. I type

$php –ini

So, I got php.ini path and I change follow line

 

search 

default_charset and change

to

default_charset = “utf-8”

 

search

 mbstring.internal_encoding

to

mbstring.internal_encoding = UTF-8

 

After that , I can use unicode in php cli. If I have a internet , I can search from google. Writting code without internet is not easy way but it was fun.

 

comments powered byDisqus