Bug #25867

German 'Umlaute' in a MySQL table-field makes ExtDirect throw an error

Added by Regine Rosewich almost 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Category:
ExtDirect
Target version:
-
Start date:
2011-04-10
Due date:
% Done:

100%

Estimated time:

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.

#1

Updated by Regine Rosewich over 10 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 over 9 years ago

  • Category set to ExtDirect
#3

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from New to Closed
  • Assignee set to Karsten Dambekalns
  • % Done changed from 0 to 100

This has long been solved in (our) Doctrine.

Also available in: Atom PDF