Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » SQL garble?

#1 2016-11-29 15:05:03

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

SQL garble?

I set up a test site with a new TXP 4.6.2 and compared the way non-ASCII characters would display and be stored in the database.

Here a
ÖÜÄ öüä

in backend/frontend finds itself changed in MySQL, to
ÖÜÄ öüä

That seems weird… (collation is utf8mb4)

I used to poke around in textpattern databases and even the weirdest UTF8 signs were appearing in body texts, scripts and what nots in clear text. That carried the advantadge of being able to edit straight in the database, if it didn’t work otherwise.

How could i turn my TXP 4.6.2 back to that kind of feature?

Last edited by jayrope (2016-11-29 15:21:14)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2017-01-04 10:28:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: SQL garble?

Hi jayrope,

This post escaped me. To you check that the collation in the config.php file is also utf8mb4?

There is the htaccess rule which forces utf-8

AddDefaultCharset utf-8

and I am wondering if you could change it to

AddDefaultCharset utf8mb4

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2017-01-04 20:07:04

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: SQL garble?

colak wrote #303480:

and I am wondering if you could change it to

AddDefaultCharset utf8mb4...

Don’t do that.
The “utf-8” that is specified in .htaccess covers both utf8 and utf8mb4. It’s only MySQL that treats them differently: utf8 is a subset of utf8mb4. The utf-8 in .htaccess is the same as utf8mb4.

Offline

#4 2017-01-05 07:06:21

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: SQL garble?

ruud wrote #303482:

Don’t do that.
The “utf-8” that is specified in .htaccess covers both utf8 and utf8mb4. It’s only MySQL that treats them differently: utf8 is a subset of utf8mb4. The utf-8 in .htaccess is the same as utf8mb4.

Question> should one, when creating a new MySQL DB bother with specifying utf8mb4 … would simple utf8 be just as good?


…. texted postive

Offline

#5 2017-01-05 13:45:41

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: SQL garble?

bici wrote #303485:

Question> should one, when creating a new MySQL DB bother with specifying utf8mb4 … would simple utf8 be just as good?

From the MySQL manual

10.1.9.3 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)

The character set named utf8 uses a maximum of three bytes per character and contains only BMP characters. As of MySQL 5.5.3, the utf8mb4 character set uses a maximum of four bytes per character supports supplementary characters:

  • For a BMP character, utf8 and utf8mb4 have identical storage characteristics: same code values, same encoding, same length.

  • For a supplementary character, utf8 cannot store the character at all, whereas utf8mb4 requires four bytes to store it. Because utf8 cannot store the character at all, you have no supplementary characters in utf8 columns and need not worry about converting characters or losing data when upgrading utf8 data from older versions of MySQL.

Offline

#6 2017-01-05 20:10:58

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: SQL garble?

bici wrote #303485:

Question> should one, when creating a new MySQL DB bother with specifying utf8mb4 … would simple utf8 be just as good?

utf8mb4 supports more characters, like emoji.

Offline

  1. Index
  2. » How do I…?
  3. » SQL garble?

Board footer

Powered by FluxBB