UTF-8法语重音字符问题 [英] UTF-8 French accented characters issue

查看:383
本文介绍了UTF-8法语重音字符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我看到数据存储在mysql数据库使用phpmyadmin,字符存储完全一样éàç但是当我使用php显示这些数据在具有以下结构的html文档:

When i see data as stored on mysql database using phpmyadmin, the characters are stored exactly as é à ç however when i use php to display these data on an html document that has the exact following structure:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
</body>
</html>

我有正方形而不是重音字符,但是,我没有这个问题与任何重音字符对于尚未从同一页面中的mysql加载的静态内容。

I got square instead of accented character, however, i don't have this issue with any accented characters on static content that haven't been loaded from mysql in the same page.

当我看到页面的源代码时,他们似乎是相同的!例如:

when i see on the source code of the page they seem to be identical! for example:

部分源代码上的静态数据显示为:

part of static data on the source code displayed as:

éçà

部分mysql起源数据:

part of mysql origin data:

éçà



i tried replacing

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

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

因此我得到了一个固定的,静态的正方形!

and as result i got mysql one fixed, static with squares !

任何提示?

推荐答案

这是很常见的字符集问题,你需要手动设置连接编码MySQL连接(这些应该是在建立连接后执行的第一个查询):

This is quite common charset issue, you need to set connection encoding manually for MySQL connection (those should be first queries you execute after establishing connection):

SET NAMES utf8;
SET CHARACTER SET utf8;

并且确保每个表都有 CHARACTER SET 设为 UTF-8

And also make sure every table has CHARACTER SET set to UTF-8.

或者您也可以更新服务器配置

这篇关于UTF-8法语重音字符问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆