shanie93 Posted May 30, 2015 Share Posted May 30, 2015 My script keeps displaying the names in Chinese, here's what I'm using; $charcount = unpack( "c", substr( $buf, $start, 1 ) ); $start = $start+1; for($MorzE=0; $i<$charcount[1]; $i++) { $charid = unpack( "N", substr( $buf, $start, 4 ) ); $start = $start+4; $namelarge = unpack( "c*", substr( $buf, $start, 1 ) ); $start = $start+1; $name = iconv( "UTF-16", "UTF-8", substr( $buf, $start, $namelarge[1] ) ); $start = $start+$namelarge[1]; if ($charid[1] == $_SESSION['charid']) { $select[$i] = ' selected="selected"'; } $roles_acc .= <<<HTML <option value='{$charid[1]}'{$select[$i]}>{$name}</option>\n <select name="role">{$roles_acc}</select><br /><br /> My Database is set to General utf-8, I have tried changing that to several different types. I've also tried adding header('Content-Type: text/html; charset=utf-8'); But it's still displaying in Chinese, any idea why? Link to comment https://forums.phpfreaks.com/topic/296549-chinese-output-i-want-english/ Share on other sites More sharing options...
jcbones Posted May 30, 2015 Share Posted May 30, 2015 Changing the encoding to utf-8 will not change the Unicode character set. The character is what the character is, in other words. To change from Chinese to English, you would have to translate it. Link to comment https://forums.phpfreaks.com/topic/296549-chinese-output-i-want-english/#findComment-1512859 Share on other sites More sharing options...
shanie93 Posted May 30, 2015 Author Share Posted May 30, 2015 And can I do that via PHP? Because the results will always be different depending on the data. Thanks for the reply Jc. Link to comment https://forums.phpfreaks.com/topic/296549-chinese-output-i-want-english/#findComment-1512860 Share on other sites More sharing options...
jcbones Posted May 30, 2015 Share Posted May 30, 2015 http://https://cloud.google.com/translate/docs Google has it. Link to comment https://forums.phpfreaks.com/topic/296549-chinese-output-i-want-english/#findComment-1512861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.