Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix character encoding issue in HTML?

I have a web page, and if I open it in Windows Notepad, a piece of text looks like this:

Avertissement sur la sécurité

But if I open it in Notepad++, it looks like:

Enter image description here

Notepad++ also says the file is in UTF-8 encoding too.

If I open it in a browser, it looks like

Enter image description here

I have

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

How can I fix this?

like image 454
omega Avatar asked Sep 14 '25 04:09

omega


1 Answers

You have to make sure the encoding on <meta> is the same like the file encoding (on Notepad++).

You want to use UTF-8?

  • On Notepad++ select Encoding -> UTF-8 (without BOM) and save the file.
  • Use <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

You want to use ISO-8859-15?

  • On Notepad++ select Encoding -> ISO-8859-15 and save the file.
  • Use <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">
like image 113
Sebastian Brosch Avatar answered Sep 15 '25 19:09

Sebastian Brosch