简体   繁体   English

聪明的特殊字符问题

[英]Smarty special character issue

I used spanish language in my site. 我在网站上使用西班牙语。 when iinserted the character like í,á,é,ó it will insert properly in db,but it cannot display in front-end, it display like this in front-end 当插入í,á,é,ó之类的字符时,它将正确插入db中,但不能在前端显示,而是在前端显示如下

for example : 例如 :

   Insert name : Test teachér in database it inserted correctly but in front it display as
Test teach�r.

i used <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> also but no changes at all. 我也使用了<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>但完全没有任何更改。

It has nothing to do with smarty. 它与聪明人无关。

  1. Check db charset where you store data and set it to UTF-8 General CI 检查存储数据的数据库字符集并将其设置为UTF-8 General CI
  2. Check charset of db connection SET NAMES utf8 检查数据库连接的字符集SET NAMES utf8
  3. Check the output of script if it's in UTF you can do it with meta charset, or in headers content-type. 检查脚本的输出是否在UTF中,可以使用meta字符集或标头content-type来完成。

Content-type: text/html; charset="UTF-8"

or 要么

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

After these operations you should have proper output. 完成这些操作后,您应该具有正确的输出。

You can also optionally check if functions that work on strings supports UTF-8. 您还可以选择检查对字符串起作用的函数是否支持UTF-8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM