Welcome Guest, Not a member yet? Register   Sign In
subst php function working properly with utf8 string
#1

[eluser]Unknown[/eluser]
Hi,
anybody knows how to use substr php function properly with utf8 string?
Maybe there is some codeigniter library?


AA
#2

[eluser]Hannes Nevalainen[/eluser]
nope, do this:
Code:
$string = 'Im in utf-8';

$string = utf8_decode($string); //Make it work with PHP str_* functions (encode in PHP-default ISO 8859-1 encodeing)

$string = strtolower($string);

$string = utf8_encode($string); //Put it back as UTF-8

PHP runs with ISO 8859-1 encodeing, thats why utf8 doesn't work properly.

Happy Coding.




Theme © iAndrew 2016 - Forum software by © MyBB