#3184 closed defect (bug) (duplicate)
UTF8 DB connections preferred
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | 2.0.4 |
| Severity: | normal | Keywords: | DB connection encoding UTF8 needs-patch |
| Cc: | jimisola |
Description
There should be an option to affirmatively change the encoding of the database connection to something other than the database server's default.
Many hosts leave their servers at the default of MySQL which is 'latin1' with the 'sewdidh_ci collation'. This messes up many non-Latin-script blogs.
The current solution is to manually add a "mysql_query("SET NAMES utf8 COLLATE utf8_unicode_ci");" statement or similar in wp-db.php which may later get overwritten when upgrading, which complicates things further.
It may be useful to make the default value of this suggested option to actually be UTF8 since it cannot harm Latin-script languages but will be more straightforward for others. Obviously some other people will still need to change the value of this option to have their language scripts correctly encoded and avoid future problems, but it will be a straightforward process by then, instead to have to annually patch the code.
Change History (8)
comment:1
markjaquith — 7 years ago
- Keywords needs-patch added
- Milestone set to 2.2
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
- Resolution set to duplicate
- Status changed from assigned to closed
Duplicate of #2828.
I think making this as a constant option is a bad idea. SET NAMES statement is so powerful to change MySQL behavior that it should be used only when we know what we are doing.
I feel I need to write a little more.
Making this as a constant is fine and useful for experts, but for non-experts,
- it should be defaultly off (commented out)
- it has to be well documented or better be a hidden option
otherwise they would possibly damage their data.
comment:8
foolswisdom — 6 years ago
- Milestone 2.2 deleted

Sounds like a good candidate for a PHP constant option. Can't be an option in the database, as you need it before you connect to the database.