Bug #25867
German 'Umlaute' in a MySQL table-field makes ExtDirect throw an error
Status: | Closed | Start date: | 2011-04-10 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
Category: | ExtDirect | |||
Target version: | - |
Description
When a table-field in a MySQL Database (Collation utf-8-general-ci) contains a German 'Umlaut' an ExtDirect-Request fails with the following error:
#1: Warning: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_ExtJS_ExtDirect_RequestHandler_Original.php line 170 (More information)
For me UTF-8 means that German 'Umlaute' should not be any problem.
History
#1 Updated by Regine Rosewich over 4 years ago
The problem can be solved (any other way, I tried did fail) by directly adding the SET NAMES "UTF-8" to the following class: \F3\Resources\PHP\Doctrine\DBAL\Driver\PDOMySQL\Driver.php as shown below.
/**
* Attempts to establish a connection with the underlying driver.
*
* @param array $params
* @param string $username
* @param string $password
* @param array $driverOptions
* @return Doctrine\DBAL\Driver\Connection
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
$conn = new \Doctrine\DBAL\Driver\PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
$driverOptions
);
$conn->exec('SET NAMES "UTF8"');
return $conn;
}
I suppose, it will be no problem to get the same result with a dedicated configuration option.
#2 Updated by Karsten Dambekalns about 3 years ago
- Category set to ExtDirect
#3 Updated by Karsten Dambekalns about 3 years ago
- Status changed from New to Closed
- Assigned To set to Karsten Dambekalns
- % Done changed from 0 to 100
This has long been solved in (our) Doctrine.