10

How do I convert a utf-8 string to a utf-16 string in PHP?

2 Answers 2

14

mbstring supports UTF-16, so you can use mb_convert_encoding.

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

Comments

3

You could also use iconv.

It's native in PHP, but require that all your text is one charset. Else it could discard characters.

Comments

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.