I create a project in Symfony and encountered a bug #57785. Apparently a bug and remains unresolved.
Who knows a way around this bug?
I will explain the problem
I created a portable app. Such application, the user normally installs on the Desktop
or My Documents
.
Example bad path for Russian:
C:\Documents and Settings\Администратор\Рабочий стол\
C:\Documents and Settings\Администратор\Мои документы\
I can restrict the user to install the application in such a directory, but it is bad practice.
Сan change assembly dsn
in the package doctrine/dbal
, but it is a very tough decision that will not always work:
Doctrine\DBAL\Driver\PDOSqlite\Driver::_constructPdoDsn(array $params)
{
$dsn = 'sqlite:';
if (isset($params['path'])) {
$dsn .= iconv('cp1251', 'utf-8', $params['path']);
} else if (isset($params['memory'])) {
$dsn .= ':memory:';
}
return $dsn;
}
Necessary get the Doctrine database driver and replace path to database file after changing the encoding.
$conn = $this->container->get('doctrine')->getConnection();
$new_path = iconv('cp1251', 'utf-8', $conn->getParams()['path']);
// further necessary change connection params