如何解决html中的字符编码问题?

ome*_*ega 4 html encoding notepad++ utf-8

我有一个网页,如果我在 Windows 记事本中打开它,一段文本看起来像这样

\n\n

Avertissement sur la s\xc3\xa9curit\xc3\xa9

\n\n

但如果我在记事本++中打开它,它看起来像

\n\n

在此输入图像描述

\n\n

Notepad++ 还说该文件也是 utf-8 编码。

\n\n

如果我在浏览器中打开它,它看起来像

\n\n

在此输入图像描述

\n\n

我有

\n\n

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">也在上面。

\n\n

有谁知道我该如何解决这个问题?

\n\n

谢谢

\n

Seb*_*sch 6

您必须确保编码与<meta>文件编码(在 Notepad++ 上)相同。

您想使用 UTF-8 吗?

  • 在 Notepad++ 上选择Encoding -> UTF-8 (without BOM)并保存文件。
  • 使用<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

您想使用 ISO-8859-15 吗?

  • 在 Notepad++ 上选择Encoding -> ISO-8859-15并保存文件。
  • 使用<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">