1 (edited by gog1 2005-10-17 09:57)

Topic: UTF-8, the final solution...

Hi,

I believe there should be a tutorial on how to make punbb use unicode (utf-8) encoding.

I am running a croatian web site that is currently using phpbb, and I have another site with SMF forum installed, and both work quite nice with utf-8 encoding.

I would like to give punBB a try, but I am running into some problems.

I've changed the template so that the forum displays itself in utf-8. I've edited /include/dblayer/mysql.php and changed

        if ($p_connect)
            $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
        else
            $this->link_id = @mysql_connect($db_host, $db_username, $db_password);

to

        if ($p_connect)
            $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
        else
            $this->link_id = @mysql_connect($db_host, $db_username, $db_password);
            [b]mysql_query("SET NAMES 'utf8'");[/b]

Posting a new message shows me (when I check the thread, and look into my mysql database) that croatian simbols are working as intended, but my problem is (and I've noticed that many other users have the same issue):

Unable to insert search index words.

This happens in /include/search_idx.php, I had a look at http://punbb.org/forums/viewtopic.php?pid=19681#p19681 but it didn't help. As far as I can see, the 2 lines in search_idx.php are the only thing stopping punbb to work in unicode, or is there something else? I saw some other posts from Rickard explaning that many functions should be rewritten if punnbb would use utf-8, so if anyone cares to explain why it would be very nice, I would really like to know.

It would be really great if you make it work with utf-8, and I see no reason why it couldn't be the dafault encoding for punbb?

Re: UTF-8, the final solution...

http://punbb.org/docs/faq.html#faq2_7

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by gog1 2005-10-17 13:28)

Re: UTF-8, the final solution...

File: c:\program files\apache group\apache\htdocs\punbb\include\search_idx.php
Line: 151

PunBB reported: Unable to insert search index words

Database reported: Duplicate entry '' for key 1 (Errno: 1062)

The funny thing is that sometimes I can enter posts with no error. With a little testing a can say that if you enter only one croatian character it works fine, but if there is more than one it is possible that there will be a problem..

I have this forum on my local machine:     Apache/1.3.31 (Win32) PHP/4.3.10, MySQL 4.1.7

4 (edited by coolhd 2005-10-18 03:01)

Re: UTF-8, the final solution...

I have a discussion about using MySQL4.1 with UTF-8, and you can see some snapshot in that article.
Sorry for the snapshot was in chinese,but you can see something keyword.

http://img.photobucket.com/albums/v197/coolhd/teach/mysql41.jpg

1. modify table "search_words" , and change the field "word" type from "varchar" to "varbinary".

http://img.photobucket.com/albums/v197/coolhd/teach/mysql41_punbb.jpg

2. edit file "/include/dblayer/common_db.php"
add:

$db->query("SET NAMES 'UTF8'");

in the last line,then save it.

3.done.

5

Re: UTF-8, the final solution...

It works, thank you very much, I didn't change field type to varbinary, I was trying utf_bin collation for that field smile I knew it was something with binary wink

Thanks again..

The big question is, can I expect some problems with utf-8?

6

Re: UTF-8, the final solution...

Anybody?

7 (edited by coolhd 2005-10-23 04:07)

Re: UTF-8, the final solution...

Did you mean this problem "Unable to insert search index words" ??

Then how about this thread : http://punbb.org/forums/viewtopic.php?id=5882

I modify table field's type to solve that problem. (I'm using Chinese in UTF-8 now,and it works fine for my forum.)

8

Re: UTF-8, the final solution...

It works, I'm just wondering if there are any limitations using utf-8...

Re: UTF-8, the final solution...

no I think there will be no limitations on utf-8 - btw. your that drkadjija from mi3 smile nice to see you m8 smile

Re: UTF-8, the final solution...

No limitations. UTF-8 *is* the way to go. We are several petitioning Rickard to make it the default charset of PunBB tongue

11

Re: UTF-8, the final solution...

UTF-8 is the way to go!

cheers Pos3idon! smile

12

Re: UTF-8, the final solution...

I have tried UTF-8 for lithuanian language - doesn't work

Re: UTF-8, the final solution...

One of the "limitation" with UTF-8 is that MySQL <4.1 doesn't support it. Right?

Re: UTF-8, the final solution...

No, it work with MySQL <4.1. Textpattern does it for example. MySQL doesn't simply understand what he is storing, but that doesn't matter.

Re: UTF-8, the final solution...

Jérémie wrote:

No, it work with MySQL <4.1. Textpattern does it for example. MySQL doesn't simply understand what he is storing, but that doesn't matter.

That's not entirely true. Sorting of the user list for example, will be off.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: UTF-8, the final solution...

I can't understand why the "English" language file is not set to UTF-8, as is now standard with just about every other PHP script I use (Wordpress, Wikimedia, etc.). Please change this!

17

Re: UTF-8, the final solution...

yehaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
big problem --- little solution
thanks so mutch

Re: UTF-8, the final solution...

Luhmann wrote:

I can't understand why the "English" language file is not set to UTF-8, as is now standard with just about every other PHP script I use (Wordpress, Wikimedia, etc.). Please change this!

Exactly!

19 (edited by Solovey 2006-09-30 10:23)

Re: UTF-8, the final solution...

Long post with PHP/MySQL/Unicode issues discussed here: http://forums.mysql.com/read.php?103,97854,99266

Re: UTF-8, the final solution...

coolhd wrote:

I have a discussion about using MySQL4.1 with UTF-8, and you can see some snapshot in that article.
Sorry for the snapshot was in chinese,but you can see something keyword.

http://img.photobucket.com/albums/v197/ … ysql41.jpg

1. modify table "search_words" , and change the field "word" type from "varchar" to "varbinary".


2. edit file "/include/dblayer/common_db.php"
add:

$db->query("SET NAMES 'UTF8'");

in the last line,then save it.

3.done.

THAT'S IT !!!

It worked for me - I work with french caracters - àéèêç

THANKS !

Re: UTF-8, the final solution...

wow. thanks all for these... really valuable input!