Strange characters when using pound sign

一笑奈何 提交于 2019-12-24 15:27:25

问题


I've already got this line in my header..

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

I have an input form and when I enter a pound sign £ it's coming out with a strange character before it. The values are stored in the database and then displayed but the problem seems to be before we even get to the database.

If I submit my form and then print_r the $_POST array I get:

[field2_title] => £ Question

I thought the issue might be with the code igniter $this->input->post() function but it's happening before then. Other than adding the meta tag which I've already done I'm not sure what else to try?

I have also tried this..

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

回答1:


In your view, try adding the following code:

<?php header('Content-Type: text/html; Charset=UTF-8'); ?>


来源:https://stackoverflow.com/questions/15575643/strange-characters-when-using-pound-sign

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!