简体   繁体   English

PHP梨字符编码

[英]php pear character encoding

I have some issue with pear since i am beginner in it. 自从我是梨初学者以来,我就遇到了一些问题。 Two characters(ő and ü) which is correctly stored in the db appearing on the php page as ?. 正确存储在数据库中的两个字符(ő和ü)在PHP页面上显示为?。

I was able to write out correctly the characters in a normal php page by: 我能够通过以下方式正确写出正常php页面中的字符:

mysqli_query($dbc,'SET NAMES UTF8');

This solved that problem but i don't know how to use this in pear. 这解决了这个问题,但我不知道如何在梨中使用它。

I use this command for sql accesing 我使用此命令进行sql访问

$dg->bind('SELECT * FROM person', $options, 'MDB2');

I try to use this analog: 我尝试使用此类似物:

 $dg->bind('SET NAMES UTF8', $options, 'MDB2');

but this isn't working gives me MDB2 Error: unknown error. 但这不起作用给我MDB2错误:未知错误。

  1. Extend class from Structures_DataGrid_DataSource_MDB2 to get acces to protected _connect() function 从Structures_DataGrid_DataSource_MDB2扩展类以获取对受保护的_connect()函数的访问权限
  2. Take instantiated databased object like that 像这样获取实例化的数据库对象

    //fill all needed options to create object $dataSource = new Structures_DataGrid_DataSource_MDB2_Extended(); $mdb2 = $dataSource->connect(); $mdb2->exec("SET NAMES utf8");

  3. Bind created data source to your Structures_DataGrid with bindDataSource 使用bindDataSource将创建的数据源绑定到您的Structures_DataGrid

  4. Run $dg->bind('SELECT * FROM person', $options, 'MDB2'); 运行$ dg-> bind('SELECT * FROM person',$ options,'MDB2');

Something like that. 这样的事情。 I don't check that code. 我不检查该代码。

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

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