Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: ankaraege on August 06, 2015, 04:50:00 PM

Title: Problem About UTF8 at Mysql, DB etc.
Post by: ankaraege on August 06, 2015, 04:50:00 PM
Hi Guys,

I have a problem about UTF8! As you can see below, (Turkish characters) all the characters are broken and nooneknowish. I have tried to edit sql file before uploading and corrected all the unknown char's to Turkish ones but after uploading via phpmyadmin, it becomes like this again. I select UTF8 before uploading as well! How can i solve this problem? I have already tried various methots but noting changed and i tried smf>maintenance>change all the databases to UTF8 coding thing as well but i got a error and characters become more complex. So I'm out of solution :(

Sorry for mistakes..

Thanks for your helps..

Edit: Forgot to add picture

Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: shawnb61 on August 06, 2015, 09:58:57 PM
Was this forum working previously for you, & then started going bad?   

Or is this a new forum?

Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: ankaraege on August 07, 2015, 12:54:45 AM
Quote from: shawnb61 on August 06, 2015, 09:58:57 PM
Was this forum working previously for you, & then started going bad?     


Or is this a new forum?


No, it's a newly builded forum. But DB is from my other forum
Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: shawnb61 on August 07, 2015, 02:02:03 AM
So you had a previous DB in which Turkish characters were properly displayed?

And when you moved/rebuilt the forum, do your old posts show goofy characters?   Or only your new posts?   Or everything, old & new?

Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: ankaraege on August 07, 2015, 02:20:38 AM
Yes, actually there were no problem.. Problem occurred after i backed up all of the data from my previous site.(site is no more)

and before moving DB, i corrected all the goofy characters manually with using notepad++.  I tried to upload sql file via  and cpanel restore section, but nothing worked, after upload, characters changed itself correct ones to goofy ones. I selected UTF8 before uploading also but none of them worked.

And also i only have a problem with old posts. There is no character problem at new posts.
Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: Topman on August 07, 2015, 03:02:30 AM
I have just finished checking and editing all the "goofy" characters in my 1950 posts.
I did it using the forum "modify" rather than going into the database using Notepad++

Might have taken me a few weeks (off and on), but now it's done and backed up.
Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: ankaraege on August 07, 2015, 03:05:18 AM
Quote from: Topman on August 07, 2015, 03:02:30 AM
I have just finished checking and editing all the "goofy" characters in my 1950 posts.
I did it using the forum "modify" rather than going into the database using Notepad++

Might have taken me a few weeks (off and on), but now it's done and backed up.

It's not that easy for 82444 posts and 9901 topics but thanks for suggestion :))
Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: margarett on August 07, 2015, 06:12:48 AM
Collation issues like those are usually caused by mismatching collations between your database and the language files you're using.

If you had a previous database, the characters might have been messed during export/move/etc (eg: your previous collation was latin1 and the dump was created with UTF8. There's no way to recover from this :( (except a manual replace like Topman had to do...)

So in order to be sure what you are running now:
* Are you using a UTF8 language pack? Does your Settings.php include $db_character_set = 'utf8';?
* What are your tables collation? (check in phpmyadmin) Then enter "smf_boards" or "smf_messages": what is the collation of the text fields?
Title: Re: Problem About UTF8 at Mysql, DB etc.
Post by: shawnb61 on August 07, 2015, 09:12:37 PM
This feels like a charset issue.  I don't think a collation issue would produce this result.  Collation dictates whether different characters are treated as equal or not on searches & queries (e.g., will 'A' = 'a' in a search, or will 'o' = 'รด'). 

Feels like a UTF8 (or UTF8MB4?) charset was stuffed into latin1 tables somehow. 

You may need to see the definition of the underlying tables themselves.   The only way I know to see it clearly is to go into myPhpAdmin and do an export.   For this purpose, it's OK to do a "Custom" export and only select the "structure" box.  You'll see something like this:

QuoteCREATE TABLE IF NOT EXISTS `smf_messages` (
  `id_msg` int(10) unsigned NOT NULL,
    .....    blah blah blah   .......
  `approved` tinyint(3) NOT NULL DEFAULT '1'
) ENGINE=MyISAM AUTO_INCREMENT=112666 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

That last line will tell you your current table's charset.  In this case, the charset is UTF8 & the collation is utf8_unicode_ci.

First & foremost, we need to know if your tables can even take Turkish characters...   If you see CHARSET=latin1, we have a bit more work to do.