Azu Posted October 27, 2007 Share Posted October 27, 2007 Hello I've tried all of the functions in PHP, and a lot of custom functions, and I can't find ANY that work right for UTF8. They either don't display the trademark (™) sign right, or don't display common accented letters such (é) right. What is a function for UTF8 that will display them all right? Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/ Share on other sites More sharing options...
darkfreaks Posted October 27, 2007 Share Posted October 27, 2007 many people below talk about using <?php mb_convert_encode($s,'HTML-ENTITIES','UTF-8'); ?> to convert non-ascii code into html-readable stuff. Due to my webserver being out of my control, I was unable to set the database character set, and whenever PHP made a copy of my $s variable that it had pulled out of the database, it would convert it to nasty latin1 automatically and not leave it in it's beautiful UTF-8 glory. So [insert korean characters here] turned into ?????. I found myself needing to pass by reference (which of course is deprecated/nonexistent in recent versions of PHP) so instead of <?php mb_convert_encode(&$s,'HTML-ENTITIES','UTF-8'); ?> which worked perfectly until I upgraded, so I had to use <?php call_user_func_array('mb_convert_encoding', array(&$s,'HTML-ENTITIES','UTF-8')); ?> Hope it helps someone else out Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/#findComment-378997 Share on other sites More sharing options...
Azu Posted October 27, 2007 Author Share Posted October 27, 2007 Thank you but when I try that it gives me this error XML Parsing Error: junk after document element =/ And also I can't find that function in php.net.. it says it cannot find it.. is it a real function? Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/#findComment-379009 Share on other sites More sharing options...
thebadbad Posted October 27, 2007 Share Posted October 27, 2007 Tried http://dk2.php.net/manual/en/function.utf8-encode.php‽ Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/#findComment-379027 Share on other sites More sharing options...
Azu Posted October 27, 2007 Author Share Posted October 27, 2007 Errors out just from a simple ampersand. XML Parsing Error: not well-formed Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/#findComment-379033 Share on other sites More sharing options...
Azu Posted October 29, 2007 Author Share Posted October 29, 2007 Bump <.< Quote Link to comment https://forums.phpfreaks.com/topic/74951-htmlentities/#findComment-380128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.