Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: 808server on September 23, 2023, 01:53:24 PM

Title: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 01:53:24 PM
I upgraded from 2.0.19 to 2.1.4 and now am getting database errors when using quotations and apostrophe errors.

I searched but I didn't see any resolve.

Any ideas?

Thanks
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: Illori on September 23, 2023, 03:14:46 PM
what exact errors are you getting?
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 07:30:11 PM
Any use of apostrophe or quotes from iOS will cause this:

Incorrect string value: '\xE2\xEF\xBF\xBD\xEF\xBF...' for column 'body' at row 1
File: /home/stompbox/public_html/smfforum/Sources/Subs-Post.php
Line: 1897
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 07:37:44 PM
"
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 07:38:12 PM
It's a problem with my site. I can post here.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 09:06:08 PM
I believe I have found the problem but how to fix it?
The upgrade.php never converted my tables over to utf8_general_ci.
So how can I convert all the tables over?
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 09:29:29 PM
I took a look at upgrade.php. Am I correct in that I have to run:
function ConvertUtf8()

?
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: Sir Osis of Liver on September 23, 2023, 10:35:11 PM
You can change collation with phpmyadmin.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 10:54:08 PM
There's a twist. There was a sql copy created in the directory and it has all the tables as MyISAM  utf8mb3_general_ci.

Is this correct or should they be utf8_general_ci?

I need to go and check on the differences. Basically the smart quotes of iOS are not accepted.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: shawnb61 on September 23, 2023, 10:58:42 PM
utf8mb3_general_ci = utf8_general_ci, they are synonyms.

You want your tables set to one of these.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: Sir Osis of Liver on September 23, 2023, 10:59:36 PM
2.1.4 installs with utf8mb3_general_ci collation.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 23, 2023, 11:45:22 PM
Thank you for the reply. Can you think of any other reason why I am getting this error even after the collation has been changed?
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: shawnb61 on September 24, 2023, 12:11:54 AM
For your SMF db to be fully utf8, 3 things must be true:
 - All of your tables are utf8-general-ci (or utf8mb3-general-ci, which is a synonym)
 - The value of $db_character_set in your Settings.php file should be: 'utf8'
 - The value of the 'global_character_set' entry in your smf_settings table should be: 'UTF-8'

I'd first check those 3 things.  The last two are usually not set if folks have manually converted to utf8 somehow. 

(Note this error has been reported before, and resolved by setting the values as noted above.  https://www.simplemachines.org/community/index.php?msg=4150709)
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 24, 2023, 01:51:23 AM
All tables are definitely utf8mb3-general-ci
$db_character_set = 'utf8';
There is no global_character_set entry in smf_settings. I will add one.
Title: Re: Apostrophe and Quotation marks causing database errors after upgrade
Post by: 808server on September 24, 2023, 01:56:31 AM
Thanks. That was it. Appreciate it.