473,783 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_en coding 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 2605
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_en coding 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*******@attgl obal.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_en coding 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*******@attgl obal.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_en coding 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_arr ay() 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*******@attgl obal.net
=============== ===
Jul 30 '06 #4

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

Similar topics

8
5277
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, etc.) What I'd like is something as simple as: CREATE TABLE junk (junklet VARCHAR(2500) CHARACTER SET UTF8)); import MySQLdb, re,urllib
3
7773
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 DB and display it onscreen. No matter which way I open the file, convert it to Unicode/leave it as is or what ever, I see all single bytes ok, but double bytes become 2 seperate single bytes. Surely there is an easy way to convert these mixed...
18
34146
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 Encoding.Convert, but that needs byte arrays. Thanks, /Ger
1
4857
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 wondering if anybody has experienced the same issues
3
2299
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 with languages. The strings are all VARCHAR with unicode (utf8) encoding. I have tried all the ways that I could think of and I have checked every website to no avail. What I am trying to do is simply open a connection to the database (using...
7
3514
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
15742
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 is something like this: ERREUR: Séquence d'octets invalide pour le codage «UTF8» : 0xe02063 (sorry, locale is french, it means "byte sequence invalid for encoding
0
5069
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 get the db to translate to UTF-8 for non technical reasons. So I have a string coming back with the character œ (ISO value 156). this character appears in .NET as a box character because 156 is not a valid Unicode character value. I have been...
24
3389
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 without 'utf8' in it, then things start to go downhill: 2a. The app assumes unicode objects internally. i.e. Whenever there is
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.