浏览器在UTF-8 cakePHP应用程序上检测到ISO-8859-1编码(Browser detects ISO-8859-1 encoding on UTF-8 cakePHP app)
在我的客户端的服务器上,当我浏览应用程序时,字符是错误的,因为所有浏览器(Firefox,Chrome,IE)都将页面解码为ISO-8859-1而不是UTF-8。 本地工作很棒,在我的服务器上工作也很好。
我有一个用cakePHP 1.3.12开发的应用程序:
- 所有文件的默认编码是UTF-8,不含BOM。
- 所有页面都有
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
在core.php中
Configure::write('App.encoding', 'UTF-8');
在database.php中
var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'aaa', 'password' => 'aaa', 'database' => 'aaa', 'prefix' => 'app_', 'encoding' => 'utf8' );
数据库,表和字段排序规则是utf8_unicode_ci
我也在bootstrap.php的开头:
echo mb_internal_encoding();
...并返回ISO-8859-1,所以我把......
mb_internal_encoding('UTF-8');
......但没有任何改变。
工作不好的服务器有PHP 5.2.16。 我认为它是客户端服务器上的模块或选项,因为本地和我的服务器工作正常。
任何想法都表示赞赏。
On the server of my client, when I browse the application, the characters are wrong, because all of the Browsers (Firefox, Chrome, IE) decode the page as ISO-8859-1 instead of UTF-8. Local works great, and on my server works fine too.
I have an application developed with cakePHP 1.3.12:
- The default encoding of all files is UTF-8 without BOM.
- All pages has
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
In core.php
Configure::write('App.encoding', 'UTF-8');
In database.php
var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'aaa', 'password' => 'aaa', 'database' => 'aaa', 'prefix' => 'app_', 'encoding' => 'utf8' );
The database, tables and fields collation is utf8_unicode_ci
I also put on the beginning of bootstrap.php:
echo mb_internal_encoding();
...and returns ISO-8859-1, so I put...
mb_internal_encoding('UTF-8');
...but nothing change.
The server that work bad has PHP 5.2.16. I think it's a module or option on the client server, because local and in my server works fine.
Any idea is appreciated.
原文:https://stackoverflow.com/questions/7681259
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
您所在的群组在您的本地names.nsf中是未知的。 将此组文档从公司的names.nsf复制到本地names.nsf中 或者使用相同的名称和您作为成员在那里创建它。 或者,您可以复制数据库而不设置“访问控制列表”选项。 然后你可以在之后将自己设置为ACL中的管理员。 不要忘记添加原始角色并最后设置选项“在所有副本中强制实施一致的访问控制列表”。 (我希望这不是关于这里提到的数据库;-) The group you are a member of is unknown in your local names ...
-
制作数据库的本地副本(Making a local copy of a database)[2023-05-08]
您可以从上下文菜单中转储模式,如图所示 You can dump your schema from the context menu like on the picture -
制作数据库副本(Make copies of database)[2022-04-28]
好的,通过简单的WHILE LOOP找到了适合我的东西; DECLARE @index int DECLARE @dbName varchar(25) declare @HRNET varchar(200) declare @HRNET_LOG varchar(200) declare @sql varchar(2000) SET @index = 5 WHILE (@index < 200) BEGIN -- Construct db name and corresponding files nam ... -
我发现了这个问题。 连接字符串错了: initial catalog=model 必须替换为 initial catalog=my_db 像现在的魅力一样工作:-) I found the problem. The connection string was wrong: initial catalog=model must be replaced with initial catalog=my_db Works like a charm now :-)
-
将其导出到单个文件( whatever.sql ),然后通过在本地计算机上运行脚本来导入它。 如果使用MySQL Workbench连接到远程服务器,则左侧有“数据导出”链接。 单击它并完成导出过程。 然后连接到本地服务器,单击“数据导入/恢复”,然后选择刚刚保存的文件。 Export it to a single file (whatever.sql), then import it by running the script on your local computer. There's a "Data ...
-
您可以在命令行中使用mysql。 ssh -C user@newhost "mysql -uUSER -pPASS -e 'create database NEW_DB_NAME;'" && mysqldump --force --log-error=mysql_error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@remotehost "mysql -uUSER -pPASS NEW_DB_NAME" You can use mysql in comma ...
-
这很容易: mysqldump -H
-u -p > myfile.sql 只要您使用正确的用户/密码凭据添加-H ,您就没有问题。 This is easy: mysqldump -H -u -p > myfile.sql As long as you add the -H with proper user / password credentials, you'll hav ... -
此过程将复制指定的包,替换对包名称(全部大写或小写)的任何引用 - 包括注释中的任何引用。 procedure copy_package (old_name IN VARCHAR2 ,new_name IN VARCHAR2 ) is ddl clob; begin ddl := dbms_metadata.get_ddl (object_type => 'PACKAGE_SPEC' ,name => old_name ); ddl := REPLACE(dd ...