Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help: Can not search Chinese input in database.


cn000

Recommended Posts

I am using Chinese simplified gb2312 on my site. But I have issue with search chinese input. When I switched to English iso-8859-1, the search works fine. I think it might be the mySQL database is using UTF-8. I tried a lot of ways to convert the chinese input to UTF-8.. But no success. Can anyone provide some information on this?

 

In gb2312 , the chinese input is "¹ºÎï³µ"

 

In iso-8859-1, the chinese input is converted to 好

 

How can I convert the "¹ºÎï³µ" to something like "好"?

 

 

Much appreciated.

 

Thanks.

Link to comment
Share on other sites

I am using Chinese simplified gb2312 on my site. But I have issue with search chinese input. When I switched to English iso-8859-1, the search works fine. I think it might be the mySQL database is using UTF-8. I tried a lot of ways to convert the chinese input to UTF-8.. But no success. Can anyone provide some information on this?

 

In gb2312 , the chinese input is "¹ºÎï³µ"

 

In iso-8859-1, the chinese input is converted to 好

 

How can I convert the "¹ºÎï³µ" to something like "好"?

Much appreciated.

 

Thanks.

If you have multibyte functions enabled in php (check your admin console's Tools -> Server Info page and search for a --enable-mbstring and/or --enable-mbstr-enc-trans values in the compilation string at the top), you can try the mb_convert_encoding function, although I don't guarantee it'll work... Here's the manual page for it:

 

mb_convert_encoding

 

It takes the input string, the encoding-from and encoding-to values, and does the conversion for you... Good luck :)

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

If you have multibyte functions enabled in php (check your admin console's Tools -> Server Info page and search for a --enable-mbstring and/or --enable-mbstr-enc-trans values in the compilation string at the top), you can try the mb_convert_encoding function, although I don't guarantee it'll work... Here's the manual page for it:

 

mb_convert_encoding

 

It takes the input string, the encoding-from and encoding-to values, and does the conversion for you... Good luck :)

 

Richard.

 

Thanks Richard

 

But I tried couple of combination. It does not convert correctly. Is there something I can do to allow mySQL query to take gb2312 charset?

Link to comment
Share on other sites

Thanks Richard

 

But I tried couple of combination. It does not convert correctly. Is there something I can do to allow mySQL query to take gb2312 charset?

Hmmmmmmm, not quite sure what to suggest at this point, but I did dig up this "tutorial"... I can't make much out of it, but perhaps you can, and it deals directly with gb2312...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...