0

I've got a problem with my charset I guess. I've called out this line of code on the top of my file.

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

when I try to read out an 'ë' it returns these two characters: ë .

I can't figure out what I have to do, to return the accented character. I also found out it only happens to be when I put the accented character into <h1> tags.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Jorden vg
  • 787
  • 2
  • 6
  • 13
  • 1
    Where is `ë` coming from database? https://stackoverflow.com/questions/279170/utf-8-all-the-way-through?rq=1 – AbraCadaver Jan 05 '18 at 16:53
  • From a word in the table called skiën(dutch for skiing). What type of answer do you need?? – Jorden vg Jan 05 '18 at 17:03
  • 1
    [UTF-8 All the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Mark Baker Jan 05 '18 at 17:03
  • 1
    1) Please explain more clearly the ***exact*** details of your situation, where does your data come from? What HTML version are you running? what "tags"? etc. etc. 2) Read the whole post linked by Mark Baker. It's invaluable. – Martin Jan 05 '18 at 17:38
  • I'm working on a live website. The page loads in data which comes out of an MySQL database. When i try to load in the title, which is echo'ed in h1 tags. The word "Skiën" is displayed as "Skën". But when i try to display "skiën" in normal text(outside of the h1 tags), it does display like it should. And i am not sure if its the charset of my sql database or its anything else. – Jorden vg Jan 10 '18 at 08:59

3 Answers3

0

Try adding this extra tag so it looks like this:

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

If the data is in a file (I guess an html file) then this may help: http://www.thedatastudio.net/character_encoding_profile.htm.

What are you reading the file with? As you suggest, I'm sure it's interpreting the file as if it were in a different character encoding.

Ron Ballard
  • 693
  • 6
  • 8
-1

If you are reading data from mysql database then you can use mysqli_set_charset() for mysqli or if you are using PDO you can try below code.

$dbh = new PDO('mysql:'.$conn, $username, $password);
$dbh->exec("set names utf8");
Lalmani Dewangan
  • 306
  • 2
  • 11