Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 26. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Any idea why sorting in greek UTF-8 does not work correctly

phpMyEdit General     Any idea why sorting in greek UTF-8 does not work correctly
Odoslať novú tému   Odpovedať na tému    
 
iomas     Založený: 03.07.2008   Príspevky: 6  
Príspevok Zaslal: 2009-05-08 08:44
Návrat hore  Odpovedať s citátom     

hello guys
I have a really strange problem there!
When i sort the database the sorting does not really works
it kind of sorts in parts
First from K-greek psi;
Then from M - X
and then all the rest A- greek omega
The table has both greek and latin names in UTF-8
Any ideas???

Thanks for your help
Ioannis

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-05-09 13:59
Návrat hore  Odpovedať s citátom     

Please post the schema for the table structure, which you can export using phpMyAdmin. (maybe the table definition is incorrect)

 
iomas     Založený: 03.07.2008   Príspevky: 6  
Príspevok Zaslal: 2009-05-10 15:43
Návrat hore  Odpovedať s citátom     

`id` INT(11) NOT NULL AUTO_INCREMENT,
`email` VARCHAR(49) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`name` VARCHAR(94) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`address` VARCHAR(130) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`occupation` VARCHAR(62) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`phone` VARCHAR(17) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`found` VARCHAR(44) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`e_type` VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`subscribed` CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`verified` CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`valid` CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`code` VARCHAR(62) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`reg_date` DATE NOT NULL,
`unsub_date` VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`rpt` VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`pass` VARCHAR(62) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`list` VARCHAR(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci';

Thanks for your attention!!!
Ioannis

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-05-10 17:47
Návrat hore  Odpovedať s citátom     

It may not be documented that if using UTF8 then you may need to hack your class file to add 2 queries in the function named execute(), below if ($this->connect() == false) { return false; }


Kód:
if ($this->connect() == false) { return false; }
// UTF8 connection.
if(!@mysql_query('SET NAMES UTF8')){ error(mysql_error()); }
if(!@mysql_query('SET COLLATION_CONNECTION=UTF8_UNICODE_CI')){ error(mysql_error()); }


COLLATION_CONNECTION for users will vary depending on the applied character set, and it looks like yours is UTF8_UNICODE_CI

 
iomas     Založený: 03.07.2008   Príspevky: 6  
Príspevok Zaslal: 2009-05-10 20:19
Návrat hore  Odpovedať s citátom     

Everything is ok!!!

Thanks a million

Ioannis

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-05-10 20:38
Návrat hore  Odpovedať s citátom     

The final piece of the puzzle, to make sure HTML is valid is to include two META tags in your page's HEAD section.

Kód:
<meta http-equiv="charset" content="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">


 
daviddelmonte     Založený: 10.04.2010   Príspevky: 15  
Príspevok Zaslal: 2010-05-17 15:45
Návrat hore  Odpovedať s citátom     

Ioannis, Doug, sorry to trouble you.. I am building a database with some contacts whose names are in greek.

In the DB itself, I can see the records in greek.

The table is in myISAM and is collated utf8_unicode_ci

I have added Doug's hacks to my phpMyEdit class file, and have the meta tags defined in my page header..

Still, while in phpMyAdmin I can see the greek names, in my web page, the letters all show as "?????".

Any ideas on what else I could have done wrong?

Many thanks!!!

David

 
daviddelmonte     Založený: 10.04.2010   Príspevky: 15  
Príspevok Zaslal: 2010-05-17 15:59
Návrat hore  Odpovedať s citátom     

OK. More info.. If I enter the name through PME, the greek letters are shown correctly. However, when I look at the raw database through phpMyAdmin, I see garbage characters. If I enter the greek letters into the raw mySQL, then they look ok in the database but are ????? in the PME pages.

At least I have a workaround, but it isn't perfect..

So ideas are still welcome.

David

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-05-17 16:11
Návrat hore  Odpovedať s citátom     

There is some sort of query to fix this but I can't remember what the query is. It has to do with going from, for example, LATIN1 to UTF8. It may be addressed in another forum post.

You "may" find the language file for Greek needs PHP's utf8_encode() function applied to those labels which contain accented characters.

If display problems persist, you might find it helpful to do a View Source on http://www.php-form-generator.com/phpmyedit/output/_outlook_tabs.php

 
daviddelmonte     Založený: 10.04.2010   Príspevky: 15  
Príspevok Zaslal: 2010-05-17 16:26
Návrat hore  Odpovedať s citátom     

okeydoke, thanks Doug.. I will post back what I find..

David

 
gutenzwerg     Založený: 29.03.2012   Príspevky: 4  
Príspevok Zaslal: 2019-08-01 15:08
Návrat hore  Odpovedať s citátom     

If You want to work with a database containing data in utf-8-format with phpMyEdit PDO-Version, You have to change

Line 322 $dsn = "mysql:host=" . $this->hn . ";dbname=" . $this->db;

this must be enlargened to:

$dsn = "mysql:host=" . $this->hn . ";dbname=" . $this->db . ';charset=utf8';

Otherwise any special-characters are replaced.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov