0

I am having some difficulty understanding how to output a UTF-16 string with PHP and having it properly displayed in the web page..

The string is from a game (it is a name) and can contain any of the characters.

I would like to output the given string "ムName" as ムName which would be interpreted by the browser as the original string ("ムName"). Thanks.

1
  • Where are you getting the string from? Commented Nov 2, 2013 at 3:13

1 Answer 1

1
<?php
$val="ムName";
echo mb_convert_encoding($val, 'HTML-ENTITIES','auto');
?>

demo: http://codepad.viper-7.com/YFnx4a (view frame source to see the encoding)

Sign up to request clarification or add additional context in comments.

2 Comments

But why would that be necessary in the first place? Would it not be much wiser to convert the string to UTF-8?
Thanks! This has worked on an initial test I am gonna get some stuff from the game and test it. Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.