HTML iframe中的字符错误 [英] Error with characters in a html iframe

查看:102
本文介绍了HTML iframe中的字符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问我会说西班牙语吗

我正在尝试显示多个phpmysql注册,这些注册将显示在iframe中.

I'm trying to display multiple php and mysql registrations which will be shown inside an iframe.

问题是,iframe会向我显示一些特殊字符的错误,例如:重音符号,感叹号等(``D.nde cuesta menos yse消费吗?'')

the problem is, iframe shows me errors for special characters such as: accents, exclamation marks, etc for example (�D�nde cuesta menos y se consume m�s?")

这是显示的内容:( )

This is what shows: (�)

在原始查询中或在第一个查询中没有显示此错误,但在iframe中显示了该错误.

In the original query or first does not show me that, but in the iframe shows me that error.

我尝试了http-equiv = "content-type" <meta content="text/html; charset=UTF-8">,但是没有用.

I tried with http-equiv = "content-type" <meta content="text/html; charset=UTF-8"> but it didn't work.

我该怎么办?

推荐答案

如果问题不在框架中显示的文件中,则可能是数据中的问题. 我总是尝试使用UTF8配置PHP,Apache和MySQL. 为此,我编辑一些配置文件.

If the problem is not in the files to display in the frame, may be the problem in the data. I always try to configure PHP, Apache and MySQL with UTF8. For this, I edit some configuration files.

MySQL :/etc/my.cnf

MySQL: /etc/my.cnf

[client]
default-character-set=utf8

[mysqld]
character-set-server=utf8
init-connect='SET NAMES utf8'
character-set-client=utf8
character_set_results=utf8

然后:

sudo service mysql restart

PHP:/etc/php.ini

PHP: /etc/php.ini

default_charset = "UTF-8"

Apache :/etc/apache2/conf.d/charset

Apache: /etc/apache2/conf.d/charset

AddDefaultCharset UTF-8

然后:

sudo service apache2 restart


连接到数据库时要考虑的另一件事:


Another thing to consider when connecting to the database:

...
$link = mysql_connect(SERVER, USER, PASSWORD);
mysql_set_charset('utf8', $link);
...


您可以使用以下命令查看所有与字符相关的变量:


You can see all characters related variables using:

SHOW VARIABLES LIKE 'c%';

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
| collation_connection     | utf8_general_ci            |
| collation_database       | utf8_general_ci            |
| collation_server         | utf8_general_ci            |
| completion_type          | NO_CHAIN                   |
| concurrent_insert        | AUTO                       |
| connect_timeout          | 10                         |
+--------------------------+----------------------------+


您必须确保iframe标记中显示的页面还具有:


You must make sure that the page displayed in the iframe tag has also:

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

我希望它能有所帮助.

这篇关于HTML iframe中的字符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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