PHP/MySQL 中的特殊字符 [英] Special characters in PHP / MySQL
问题描述
我在数据库中有包含特殊字符的单词(主要是西班牙语,如波浪号).在数据库中,所有内容都使用 PHPmyAdmin 保存并正确显示,但是当我获取数据(使用 PHP)并将其显示在浏览器中时,我得到一个奇怪的字符,例如?"用正方形...我需要一个通用的修复,所以我不需要每次都转义每个字符,而且我还可以将特殊的西班牙语字符从 PHP 表单插入到数据库中...
I have in the database words that include special character (in Spanish mostly, like tildes). In the database everything is saved and shown correctly with PHPmyAdmin, but when I get the data (using PHP) and display it in a browser, I get a weird character, like a "?" with a square... I need a general fix so I don't need to escape each character every time, and also I would be able to insert special Spanish characters from a PHP form into the database...
HTML 是正确的:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
所有表和数据库都设置为utf8_spanish
All tables and databas are set to utf8_spanish
我得到的字符:
有什么建议???
谢谢!!!
推荐答案
将 HTML 字符集更改为 ISO-8859-1 解决了问题!傻
Changed the HTML charset to ISO-8859-1 fixed the problem! Silly
这篇关于PHP/MySQL 中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!