Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Sunday, October 18, 2026
About Us
O nás
Magazine
Magazín
Open Source
Otvorený softvér
CVS
CVS
Services
Služby
Index  »  Projects  »  phpMyEdit  »  Forum  »  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
Post new topic   Reply to topic    
 
iomas     Joined: 03 Jul 2008   Posts: 6  
Post Posted: 2009-05-08 08:44
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-05-09 13:59
Back to top  Reply with quote     

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

 
iomas     Joined: 03 Jul 2008   Posts: 6  
Post Posted: 2009-05-10 15:43
Back to top  Reply with quote     

`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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-05-10 17:47
Back to top  Reply with quote     

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; }


Code:
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     Joined: 03 Jul 2008   Posts: 6  
Post Posted: 2009-05-10 20:19
Back to top  Reply with quote     

Everything is ok!!!

Thanks a million

Ioannis

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-05-10 20:38
Back to top  Reply with quote     

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

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


 
daviddelmonte     Joined: 10 Apr 2010   Posts: 15  
Post Posted: 2010-05-17 15:45
Back to top  Reply with quote     

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     Joined: 10 Apr 2010   Posts: 15  
Post Posted: 2010-05-17 15:59
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-05-17 16:11
Back to top  Reply with quote     

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     Joined: 10 Apr 2010   Posts: 15  
Post Posted: 2010-05-17 16:26
Back to top  Reply with quote     

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

David

 
gutenzwerg     Joined: 29 Mar 2012   Posts: 4  
Post Posted: 2019-08-01 15:08
Back to top  Reply with quote     

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.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Odkazový formulár · Application form · Prihláška
Report bug on PLATON.SK website · Upozorniť na chybu na PLATON.SK webstránke · Terms of use · Podmienky použitia · Privacy policy · Ochrana osobných údajov