【发布时间】:2018-12-10 23:06:03
【问题描述】:
为什么数据库中的数据不是 utf8 编码的? utf8mb64_general_ci 为每个列、表和数据库本身设置。 我的学说.yaml 如下:
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
我仍然得到例如“Ogólne”代替“Ogólne”。
该问题仅发生在生产中。本地编码是可以的。 我在生产环境中使用 MySQL 5.7,在本地使用 MariaDB 10.1。
【问题讨论】:
标签: php symfony doctrine symfony4 utf8mb4