简体   繁体   中英

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 ?.

I was able to write out correctly the characters in a normal php page by:

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

$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.

  1. Extend class from Structures_DataGrid_DataSource_MDB2 to get acces to protected _connect() function
  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

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

Something like that. I don't check that code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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