Advertisement:

Author Topic: Problem with bosnian letters 'č, ć, đ'  (Read 7482 times)

Offline juvebalkan

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
Problem with bosnian letters 'č, ć, đ'
« on: December 01, 2009, 06:43:40 AM »
Hello.

First of all, I wanna tell that I upgraded yesterday from SMF 1.1.10 to 2.0 RC2. With version 1.1.10 those letters were working fine and without any problems.

I'm using English-utf8 as default language, and also I have Croatian-utf8 but there is no difference if I change it. It's not working and with croatian language.

Coallition in my database is utf8_unicode_ci which I changed using this manually made script:

Code: [Select]
<?php
$db 
mysql_connect('localhost','database_username','database_password');
if(!
$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('database_name'); $result=mysql_query('show tables');
while(
$tables mysql_fetch_array($result)) {
foreach (
$tables as $key => $value) {
mysql_query("ALTER TABLE $value COLLATE utf8_unicode_ci");
}}
echo 
"The collation of your database has been successfully changed!";
?>

Of course I replaced with my infos and it did the job.

In Settings.php is like this:
Code: [Select]
$db_character_set = 'utf8';
Code: [Select]
$language = 'english-utf8';   

I have searched the entire forum and I think i followed everything right but still I can't see thos letters ( ??? are appearing instead of those letters)

The strange thing is that letters š, ž are working but not č, ć, đ.

Any reasonable solution ?

Offline juvebalkan

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
Re: Problem with bosnian letters 'č, ć, đ'
« Reply #1 on: December 01, 2009, 01:33:13 PM »
Anyone ?  :-\

Offline juvebalkan

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
Re: Problem with bosnian letters 'č, ć, đ'
« Reply #2 on: December 01, 2009, 05:30:29 PM »
Maybe Im on a way to solve this.

When I removed from Settings.php this line

Code: [Select]
$db_character_set = 'utf8';
...I was able to post all those characters. But in the existing posts, they are not recognizable. They appear with some strange characters like ? or � or something like that.

So is there a way to make those characters appear correctly ?

Note that now I can post  those characters in new posts and they are ok, appearing well, but in old posts they are not recognizable.

Offline Norv

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 18,313
  • Blue Wolf
Re: Problem with bosnian letters 'č, ć, đ'
« Reply #3 on: December 12, 2009, 10:38:06 PM »
First, an idea: your script might be wrong. It should do:
Code: [Select]
mysql_query("ALTER TABLE $value CONVERT TO CHARACTER SET 'utf8' COLLATE utf8_unicode_ci");

However, you shouldn't convert to UTF8 manually, anyway: SMF has a tool that helps doing that and changing all necessary parameters (those it uses itself): Admin > forum maintenance > Convert to UTF8.

The line in Settings.php is necessary for SMF to know it's dealing with an UTF-8 database, in case your database was in reality converted (please note that unless I'm missing something, with your script, the existing characters were not converted, only the default character set of the future columns that would be created in that table changed). You may want to restore the backup from before running the script, then, take a look at SMF's Admin tool mentioned.
What charset did your tables have before? What charset do your columns have now?
To-do lists are for deferral. The more things you write down the later they're done… until you have 100s of lists of things you don't do.
File a security report | Developers' Blog | Bug Tracker

Also known as Norv on D* | Norv N. on G+ | Norv on Github