Special Characters in the database

Here you can find plenty of help with your general coding needs and projects
If it is about a specific program, use the corresponding forum
DO NOT ask basic questions such as "How do I print a variable", use Google for that

Special Characters in the database

Postby Aränel » Fri Jan 05, 2007 12:20 pm

Hi,

I have been surprised to see that all special caracters are encoded in the database, that's not handy if you want to open your roster data to an other application.
So I am trying to find the function to make the conversion, but I do not find anything because I can't even figure out what kind of encoding it is. I does not seems to be done in the database table, but rather before when the records are inserted.
I'll probably find a way to do it but since there's already 2 hours that I am searching, I rather prefear to ask you all and switch to others things until I got a reply :mrgreen:

Here's what I want to do:
My nickname, for instance, is Aränel.
In the members table, its encoded as Aränel
When I query my base like this
Code: Select all
SELECT * FROM `WoW_members` WHERE `name`='Aränel'

it don't find the record.
So I need the PHP function to convert all special characters in my query fields before trigger it.

Txs for lighting me
Last edited by Aränel on Fri Jan 05, 2007 12:22 pm, edited 1 time in total.
Aränel - ROL admin
www.rebirthoflight.net
User avatar
Aränel
WR.net Apprentice
WR.net Apprentice
 
Posts: 21
Joined: Wed Dec 06, 2006 6:48 pm
Location: Brussels, Belgium

Special Characters in the database

Postby PleegWat » Fri Jan 05, 2007 1:21 pm

You need utf8_decode.

The data in roster is utf8 everwhere, but the character set in the database doesn't reflect that. Which causes those errors.

We're not taking the risk of switching it around in the 1x branch, also because of compatibility. R2 will use utf8 DB tables by default.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Special Characters in the database

Postby Aränel » Fri Jan 05, 2007 3:45 pm

You wrong I needed utf8_encode :blackeye:

Tank you very much that's working like a charm :thumleft:
Aränel - ROL admin
www.rebirthoflight.net
User avatar
Aränel
WR.net Apprentice
WR.net Apprentice
 
Posts: 21
Joined: Wed Dec 06, 2006 6:48 pm
Location: Brussels, Belgium

Special Characters in the database

Postby zanix » Fri Jan 05, 2007 11:53 pm

...I always get those two functions mixed up
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Special Characters in the database

Postby PleegWat » Sat Jan 06, 2007 5:30 am

Damn you're right, didn't read your post correctly.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Special Characters in the database

Postby Malcolm » Sun Jan 07, 2007 5:26 pm

I'm also having some trouble with the encoding.

I have a toon in the database under the name of: Übershammy
The database has this stored as: Ãœbershammy

This is how I'm trying to retreave the information:
Code: Select all
echo $res['name']."<br />\n";
echo utf8_decode($res['name'])."<br />\n";
echo utf8_encode($res['name'])."<br />\n";

and this is what I get
Code: Select all
Ãœbershammy
Ã?bershammy
Ãœbershammy

When the page header is set to the ISO-8859-1 character set and
Code: Select all
Ãœbershammy
�?bershammy
Ãœbershammy

under UTF-8.

Any ideas on what I'm doing wrong?
Malcolm
WR.net Apprentice
WR.net Apprentice
 
Posts: 22
Joined: Sun Jul 23, 2006 8:57 am

Special Characters in the database

Postby zanix » Sun Jan 07, 2007 6:05 pm

Are you using the header() function to set the encoding on the page?
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Special Characters in the database

Postby Malcolm » Sun Jan 07, 2007 6:10 pm

I am
{edit}
This is what I have been using, I believe it to be right :)

header('Content-Type: text/html; charset=ISO-8859-1');
header('Content-Type: text/html; charset=UTF-8');
Last edited by Malcolm on Sun Jan 07, 2007 6:18 pm, edited 2 times in total.
Malcolm
WR.net Apprentice
WR.net Apprentice
 
Posts: 22
Joined: Sun Jul 23, 2006 8:57 am

Special Characters in the database

Postby zanix » Sun Jan 07, 2007 6:22 pm

I just tried the same thing
Here is what I got

Code: Select all
$text 'Ãœbershammy';

header('Content-Type: text/html; charset=iso-8859-1');

echo 
$text."<br />\n";
echo 
utf8_decode($text)."<br />\n";
echo 
utf8_encode($text)."<br />\n"


And this was the result
Code: Select all
Ãœbershammy
Übershammy
Übershammy
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Special Characters in the database

Postby Malcolm » Sun Jan 07, 2007 7:17 pm

Weird, doesn't work on my development server, works on my live server.

Sorry for wasting your time :(
Malcolm
WR.net Apprentice
WR.net Apprentice
 
Posts: 22
Joined: Sun Jul 23, 2006 8:57 am

Special Characters in the database

Postby zanix » Mon Jan 08, 2007 12:57 am

No, it's ok
Better to learn than to not know at all right?
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Special Characters in the database

Postby Aränel » Mon Jan 08, 2007 4:03 am

probably an option to change in your php.ini to make it working locally
Aränel - ROL admin
www.rebirthoflight.net
User avatar
Aränel
WR.net Apprentice
WR.net Apprentice
 
Posts: 21
Joined: Wed Dec 06, 2006 6:48 pm
Location: Brussels, Belgium

Re: Special Characters in the database

Postby VoodooFX » Sat Apr 21, 2007 8:57 pm

Could anyone point me out what to change in order to display members with special character names correctly on all roster pages ?

I have PHP version 5+ on my server.

Thx
VoodooFX
WR.net Apprentice
WR.net Apprentice
 
Posts: 10
Joined: Thu Apr 12, 2007 9:48 pm

Re: Special Characters in the database

Postby darkraver » Tue Jun 05, 2007 7:32 pm

i've got some similar problem, in the DB the character apears with the special characters but in the roster they are ok ... from what i've notive the characterprofile.lua file had this same problem.

I've notice that after instaled the sysnc phpbb grp's with the roster character info, and when i was checking the DB i changed some names but when i update the characterprofile.lua again i get the same problems with the names ...

TKS :)
User avatar
darkraver
WR.net Apprentice
WR.net Apprentice
 
Posts: 20
Joined: Fri Aug 18, 2006 2:07 pm

Special Characters in the database

Postby EFKCYAN » Sun Mar 23, 2008 11:01 pm

well im having the same issue in my 1.7.3 roster having a character with some unusual character in his name and the roster's home page even show me a bug"Vodk�" instead of "Vodkà" doesnt seems like the probleme has been solved, if ther a way to check it up again :p
EFKCYAN
WR.net Apprentice
WR.net Apprentice
 
Posts: 12
Joined: Fri Jul 07, 2006 8:14 am


Return to General Code Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron