1

How do I interpret some characters into their proper form in PHP?

For example, the string is \u00c9rwin but PHP print it as Érwin, and the correct form must be Érwin

What is the proper PHP code for this? I am pretty sure this is not an HTML entity, or is it?

P.S. no encoding was declared on the PHP file

1

2 Answers 2

2

Look into utf8_encode and utf8_decode. It's important as well to go UTF8 across the whole stack. What that means is that your database connection should be using UTF8 (here's how in MySQL), your HTTP Content-Type should be returning UTF8 (see mgraph's example below) and you should also be setting it in the meta tag so that there is no need to encode/decode at all as you're using the same charset everywhere.

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

Comments

1

add this in header:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

or:

<?php header ('Content-type: text/html; charset=utf-8'); ?>

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.