WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#3184 closed defect (bug) (duplicate)

UTF8 DB connections preferred

Reported by: agharbeia Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: Administration Keywords: DB connection encoding UTF8 needs-patch
Focuses: Cc:

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)

#1 @markjaquith
12 years ago

  • Keywords needs-patch added
  • Milestone set to 2.2
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

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.

#2 @Nazgul
12 years ago

How does this relate to #2942?

#3 @Nazgul
12 years ago

Is this a duplicate of #2828?

#4 @jimisola
12 years ago

  • Cc public@… added

#5 @tenpura
12 years ago

  • 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.

#6 @tenpura
12 years ago

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.

#7 @jimisola
12 years ago

  • Cc jimisola added; public@… removed

#8 @foolswisdom
11 years ago

  • Milestone 2.2 deleted
Note: See TracTickets for help on using tickets.