Topic: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

I have problem with some utf 8 charater in punBB.
when I try to post "?i?n", it become "?i?n", or "h?c" -> "H?c"...
I can't read in phpMyadmin, because all like "C�ng hoà xã h�i"

I got the same error with my post-page when save to mysql.
However I fixed it by add "mysql_query("SET NAMES 'utf8'", $Sql);"
after select mydatabase:

//
$Sql = mysql_connect("localhost","root","") or die ("error");
mysql_select_db("xyz",$Sql) or die ("error");
mysql_query("SET NAMES 'utf8'", $Sql);
//

My post-page works fine, and in phpMyadmin all nice.
So, anyone help me about this.
---
Apologies for my bad english.

:Maxthon:FireFox:MirandaIM:ThunderBird:SmartFTP:FreePOPs:HTTrack:uTorrent:
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam:

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

And you are serving your pages as UTF-8?

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

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

Replika wrote:

I have problem with some utf 8 charater in punBB.
when I try to post "?i?n", it become "?i?n", or "h?c" -> "H?c"...
I can't read in phpMyadmin, because all like "C�ng hoà xã h�i"

I got the same error with my post-page when save to mysql.
However I fixed it by add "mysql_query("SET NAMES 'utf8'", $Sql);"
after select mydatabase:

//
$Sql = mysql_connect("localhost","root","") or die ("error");
mysql_select_db("xyz",$Sql) or die ("error");
mysql_query("SET NAMES 'utf8'", $Sql);
//

My post-page works fine, and in phpMyadmin all nice.
So, anyone help me about this.
---
Apologies for my bad english.

It looks like you use vietnamese unicode utf-8, right ?
If yes, firstly have a look at HTML headers (reply of Rickard). And then do a visit at our forum (url found in my signature).
After that, if you have any problem with vietnamese & punbb, just post your question here or at VnOSS forum.

[no signature]

4 (edited by Replika 2005-08-27 13:40)

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

thanks.
punBB show exactly Vietnamese form file lang.
My problem is when i try to to post a topic and punBB save it to Mysql.
There're an error appears:
"An error was encountered
Error: Unable to fetch search index words."
but the topic is posted with wrong character.

http://www.offsiteimages.com/thumb/33595.gif

I think the reason is MySQL 4.1.

@vnpenguin:
minh khong tim thay van de nay tren trang cua ban.
Ban co the giup minh ko, minh moi dung PunBB.

:Maxthon:FireFox:MirandaIM:ThunderBird:SmartFTP:FreePOPs:HTTrack:uTorrent:
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam:

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

"vietnamese unicode utf-8"? I thought the whole idea of Unicode was to prevent localized character sets smile

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

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

Rickard wrote:

"vietnamese unicode utf-8"? I thought the whole idea of Unicode was to prevent localized character sets smile

You're right. But the notion Unicode is too big wink So "Vietnamese Unicode" means that's a subset of Unicode for vietnamese language wink Of course there is no sense with HTML header, but it's important to know with the fonts.

[no signature]

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

Replika wrote:

thanks.
punBB show exactly Vietnamese form file lang.
My problem is when i try to to post a topic and punBB save it to Mysql.
There're an error appears:
"An error was encountered
Error: Unable to fetch search index words."
but the topic is posted with wrong character.

I think the reason is MySQL 4.1.

Hmm, i don't think so. VnOSS forum runs with MySQL 4.1.10 without any problem. No special configuration of MySQL was made in our server.

Replika wrote:

@vnpenguin:
minh khong tim thay van de nay tren trang cua ban.
Ban co the giup minh ko, minh moi dung PunBB.

Yes, I could help you. Just post your question/error at VnOSS forum.

[no signature]

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

vnpenguin wrote:

Hmm, i don't think so. VnOSS forum runs with MySQL 4.1.10 without any problem. No special configuration of MySQL was made in our server.

And your PHP version?

I use WindowsXP sp2, ISS 5.1, php 5.0.4(zip), mySql 4.1.12a(exe), punBB 1.2.6 is tested on localhost.
Use Vietnamese.zip from punBB-download.

please read this article:
http://www.phpbb.com/kb/article.php?article_id=308;
->How to  set name or character set = utf8 after select database in "Mighty punBB" smile

:Maxthon:FireFox:MirandaIM:ThunderBird:SmartFTP:FreePOPs:HTTrack:uTorrent:
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam:

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

<ping></pong> sad
How to query to mysql: set charset = utf-8 after select database in PunBB
like:
$Sql = mysql_connect("localhost","root","") or die ("error");
mysql_select_db("xyz",$Sql) or die ("error");
mysql_query("SET NAMES 'utf8'", $Sql);

:Maxthon:FireFox:MirandaIM:ThunderBird:SmartFTP:FreePOPs:HTTrack:uTorrent:
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam:

10 (edited by Jim 2005-10-15 19:10)

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

I have similiar problem, in my localhost MySQL 4.1 and PHP 5.0.5 works Czech characters fine, but on providers MySQL 4.1 and PHP 5.0.5 charakters are wrong. For encoding for czech characters I use ISO-8859-2.

I edit .\phpbb\upload\include\dblayer\mysql.php file and change this:

if ($p_connect) {
            $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
            mysql_query("SET NAMES 'latin2'",$this->link_id);
}

still doesnt work.

Any help?  Please...

EDIT:  I fixed this problem, my fault. Apologize... Works fine

11 (edited by bl4z 2005-12-03 09:39)

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

ok .. i had same problems like u all (with utf slovenian language ... so i start lookin why my message is f* up) coz if i eneter utf message in phpMyAdmin post was ok .. but not if i posted via forum .. so what i did was

1. cahnged this in mysql.php (round line 50)

if (@mysql_select_db($db_name, $this->link_id)) {
   @mysql_query("SET NAMES utf8", $this->link_id);
   return $this->link_id;
} else {
   error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}

2. in functions.php i found out that pun_trim somehow chaneged some of my utf letters so i did this (round line 721)

function pun_trim($str)
{
    /*
    global $lang_common;

    if (strpos($lang_common['lang_encoding'], '8859') !== false)
    {
        $fishy_chars = array(chr(0x81), chr(0x8D), chr(0x8F), chr(0x90), chr(0x9D), chr(0xA0));
        return trim(str_replace($fishy_chars, ' ', $str));
    }
    else
        
    */    
    return trim($str);
}

everythings works just fine now

12 (edited by Replika 2005-12-07 07:54)

Re: problem with utf 8 + php 5.0.4 + mysql 4.1.12a.

Fine, in phpmyadmin, it stored in utf-8 encode.
But when i view source of my forum (from ie):

    <li id="navindex"><a href="index.php">Diá»?n Ä?Ã n</a> | </li>
    <li id="navuserlist"><a href="userlist.php">Danh sách ngưỠi dùng</a> | </li>
    <li id="navsearch"><a href="search.php">Tìm kiếm</a> | </li>
    <li id="navprofile"><a href="profile.php?id=2">Xác lập cá nhân</a> | </li>
    <li id="navadmin"><a href="admin_index.php">Quản lý diá»?n Ä?à n</a> | </li>
    <li id="navlogout"><a href="login.php?action=out&id=2">Thoát</a></li>

Does it show like in phpmyadmin?

:Maxthon:FireFox:MirandaIM:ThunderBird:SmartFTP:FreePOPs:HTTrack:uTorrent:
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam: