473,396 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems with unicode utf8

Hey,

Currently me and a friend are coding up a new BitTorrent tracker. We
have a torrents table that has a column called 'info_hash' which
contains the info_hash as received by the announce.php script (this is
used to identify the torrent).

If we have the collation as latin1_general_ci, and I don't send any SET
NAMES OR SET CHARACTER SET queries after connecting, my announce script
can successfully retrieve the row from the torrents table. We however
want to use unicode throughout the project.

When I changed the charset of the table/db to utf8, the select
statement stopped working. It should be noted however that phpmyadmin
can successfully execute the same query when the table/db is set to
utf8.

After calling mysql_connect I send SET NAMES 'utf8' and SET CHARACTER
SET 'utf8', but when I called mysql_client_encoding is returns latin1
however, which is what I think is the problem.

I am using PHP 5 and Mysql 5. Can anybody help me out?

Thanks.

Jul 29 '06 #1
3 2585
Joshua Morgan wrote:
Hey,

Currently me and a friend are coding up a new BitTorrent tracker. We
have a torrents table that has a column called 'info_hash' which
contains the info_hash as received by the announce.php script (this is
used to identify the torrent).

If we have the collation as latin1_general_ci, and I don't send any SET
NAMES OR SET CHARACTER SET queries after connecting, my announce script
can successfully retrieve the row from the torrents table. We however
want to use unicode throughout the project.

When I changed the charset of the table/db to utf8, the select
statement stopped working. It should be noted however that phpmyadmin
can successfully execute the same query when the table/db is set to
utf8.

After calling mysql_connect I send SET NAMES 'utf8' and SET CHARACTER
SET 'utf8', but when I called mysql_client_encoding is returns latin1
however, which is what I think is the problem.

I am using PHP 5 and Mysql 5. Can anybody help me out?

Thanks.
Since all of your info is about MySQL, maybe you should ask in a MySQL
newsgroup - such as comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 29 '06 #2
I actually managed to get help via IRC.

I posted it here because I thought it may have been a PHP issue (i.e.
not being able to change connection's character set and collation via
PHP).

Thanks,

Josh

Jerry Stuckle wrote:
Joshua Morgan wrote:
Hey,

Currently me and a friend are coding up a new BitTorrent tracker. We
have a torrents table that has a column called 'info_hash' which
contains the info_hash as received by the announce.php script (this is
used to identify the torrent).

If we have the collation as latin1_general_ci, and I don't send any SET
NAMES OR SET CHARACTER SET queries after connecting, my announce script
can successfully retrieve the row from the torrents table. We however
want to use unicode throughout the project.

When I changed the charset of the table/db to utf8, the select
statement stopped working. It should be noted however that phpmyadmin
can successfully execute the same query when the table/db is set to
utf8.

After calling mysql_connect I send SET NAMES 'utf8' and SET CHARACTER
SET 'utf8', but when I called mysql_client_encoding is returns latin1
however, which is what I think is the problem.

I am using PHP 5 and Mysql 5. Can anybody help me out?

Thanks.

Since all of your info is about MySQL, maybe you should ask in a MySQL
newsgroup - such as comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 30 '06 #3
Joshua Morgan wrote:
Jerry Stuckle wrote:
>>Joshua Morgan wrote:
>>>Hey,

Currently me and a friend are coding up a new BitTorrent tracker. We
have a torrents table that has a column called 'info_hash' which
contains the info_hash as received by the announce.php script (this is
used to identify the torrent).

If we have the collation as latin1_general_ci, and I don't send any SET
NAMES OR SET CHARACTER SET queries after connecting, my announce script
can successfully retrieve the row from the torrents table. We however
want to use unicode throughout the project.

When I changed the charset of the table/db to utf8, the select
statement stopped working. It should be noted however that phpmyadmin
can successfully execute the same query when the table/db is set to
utf8.

After calling mysql_connect I send SET NAMES 'utf8' and SET CHARACTER
SET 'utf8', but when I called mysql_client_encoding is returns latin1
however, which is what I think is the problem.

I am using PHP 5 and Mysql 5. Can anybody help me out?

Thanks.

Since all of your info is about MySQL, maybe you should ask in a MySQL
newsgroup - such as comp.databases.mysql.


I actually managed to get help via IRC.

I posted it here because I thought it may have been a PHP issue (i.e.
not being able to change connection's character set and collation via
PHP).

Thanks,

Josh
(Top posting fixed)

Joshua,

Not a problem posting here - I was just trying to direct you to the
group which should provide better help. All of your comments had to do
with MySQL and nothing was PHP specific, which might give you a clue
that a mysql newsgroup would be a better place to start.

If, OTOH, you were having trouble with the PHP end such as getting
mysql_fetch_array() to work properly, this would be a good place to start.

I'm glad you were able to get help via IRC.

P.S. Please don't top post. This newsgroup uses bottom posting as a
standard. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
1
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
3
by: roland.saad | last post by:
Hi Everyone, I have been trying to build a website that has multilingual support using the LAMP setup. I have created tables that store language information and correlate different strings ids...
7
by: aine_canby | last post by:
Hi, Im totally new to Python so please bare with me. Data is entered into my program using the folling code - str = raw_input(command) words = str.split() for word in words:
9
by: thijs.braem | last post by:
Hi everyone, I'm having quite some troubles trying to convert Unicode to String (for use in psycopg, which apparently doesn't know how to cope with unicode strings). The error I keep having...
0
by: deloford | last post by:
Hi This is going to be a question for anyone who is an expert in C# Text Encoding. My situation is this: I have a Sybase database which is firing back ISO-8559 encoded strings. I am unable to...
24
by: Donn Ingle | last post by:
Hello, I hope someone can illuminate this situation for me. Here's the nutshell: 1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale. 2. If this returns "C" or anything...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.