PHP/MySQL中的特殊字符 [英] Special characters in PHP / MySQL

查看:90
本文介绍了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屋!

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