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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.