473,222 Members | 1,741 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,222 software developers and data experts.

Problem with Greek characters

12
Hi all,

I have a problem with my php and mysql project.
I use an auctions software, named phpauction for my project.

I import into my database with utf8 encodingm and I can see the greek letters inside the fields.
The problem is that when i go to the site for the results, I get question marks instead of the greek characters.
I have searched a lot, and i found that there is a solution by adding mysql_query("SET NAMES utf8") after mysql_select_db.

Is that correct?
Also, i can not find the mysql_select_db in any of the files.


P.S. When I import to mysql i do it from a notepad file that i save it to *****.sql
I used the default encoding and utf8 encoding but nothing.

i export the query i imported and did these:
I uploaded in the sever and with default encoding Greek, it was displayed correctly. I changed browser encoding to UTF8 and i got question marks.
Then using Notepad again i saved it with utf-8 encoding and now it is displayed correctly with UTF8 encoding select by default to the browser.
So, I guess some of my pages are not designed for utf8 encoding.
If it is so, that gives me two options.
A. To get the html code of all my pages, open it with notepad and encode it with utf8
B. To put the meta charset for utf8 to all of my pages. ( Have in mind that i did that for the pages that are used for the searching section, and also I did it with the combination of saving it with notepad in utf8 )
Also, I import some items for the importing/exporting test you told me.
I have mysql and collations to utf8 general ci

1. Using the default encoding of notepad,I import the sql file and i got question marks. i did not exported it.
2. I saved the sql with utf8 encoding now. I uploaded it and mysql displays it right. I searched it through the site and it gave me question marks again. The encoding of browser is set to UTF8. Then i exported it from mysql, saved it into html, uploaded it, opened it and with greek encoding (default is right) utf8 gives me question marks
Sep 20 '08 #1
12 9657
Atli
5,058 Expert 4TB
Hi.

Are you filtering the data in your PHP code before printing it?
Like say, by using the htmlentities function?

It could be that your data is being stored correctly in MySQL, but being treated incorrectly by PHP before it is echoed.
Sep 20 '08 #2
Punkis
12
Hi, thank you for your reply.

I tried to find the file that does this work (as i said is not developed by me)
and found this :

[PHP]/* this subastas title and link to details */
$tplv['id']=$row['id'];
$tplv['idformat']="<A HREF=\"".$SETTINGS['siteurl']."item.php?id=".$row['id']."\">";

$tplv['idformat'] .= stripslashes(htmlspecialchars($row['title'])); $tplv['idformat'].= "</FONT></A>";[/PHP]


so i guess there must be something with this
$tplv['idformat'] .= stripslashes(htmlspecialchars($row['title']));

but i do not know what!
Sep 20 '08 #3
Atli
5,058 Expert 4TB
Yea, that's it.

The htmlspecialchars function will use the default ISO charset unless you specify the charset in it's 3'rd parameter.

Like, for example:
Expand|Select|Wrap|Line Numbers
  1. echo htmlspecialchars($unicodeText, ENT_COMPAT, "UTF-8");
  2.  
Sep 20 '08 #4
Punkis
12
I changed it to this

Expand|Select|Wrap|Line Numbers
  1. $tplv['idformat'] .= stripslashes(htmlspecialchars($row['title'], ENT_COMPAT, "UTF-8"));
  2.  
  3.  
  4.  
but again, nothing..
Is there any chance that the greek letters into the queries i import are not written in utf8?
Sep 20 '08 #5
Atli
5,058 Expert 4TB
Yea, that should work.
Does it?
Sep 20 '08 #6
Punkis
12
Yea, that would work.

That is; if you replace your two dotted lines with the two extra parameters I posted above (ENT_COMPAT and "UTF-8").
but again, nothing..

Is there any chance that the greek letters into the queries i import are not written in utf8?
I do save my sql before i import it with notepad and i encode it with utf8
Sep 20 '08 #7
Atli
5,058 Expert 4TB
It could be written in any number of char sets.

Greek characters can be encoded in a lot of different char sets.
The ISO-8859-7 char set is a specialized Greek char set I believe.

If it is encoded in that, it would be displayed incorrectly as UTF-8.

Does it work in either one?
Try changing the charset of the browser. See if anything makes it look right.

(You can change it on the fly in many browsers. In Firefox you can do: View->Character Encoding... and just select one from the list)
Sep 20 '08 #8
Punkis
12
my the pages that take part for the search are encoded to utf8 and meta charset to utf8 too.
I import the query encoded with utf8 into a utf8_general_ci table into a utf8_general_ci mysql.

And the problem still remains.
I think the problem is in that line you told me.
Maybe changing htmlspecialchars with something else.

also,
when i write into a page from the html editor Greek letters, then if i want to edit it again it shows me this. If i convert the Greek letters like below? What encoding is that? When i firstly posted it her it covert it to greek letters! :P

<tr><td>Μπορείτε να καταχώρησετε τα προιόντα </td></tr>
& # 9 2 4 ; & # 9 6 0 ; & # 9 5 9 ; & # 9 6 1 ; & # 9 4 9 ; & # 9 4 3 ; &# 96 4; &# 94 9; να

without spaced
Sep 20 '08 #9
Atli
5,058 Expert 4TB
Those are HTML encoded characters. They aren't really a charset, but rather html *entities* that represent a character regardless of the charset the page is using.
For example, &#93 ; (without the space) represents ]

This isn't how it is stored in your database is it?

If this is caused by the htmlspecialchars function, then you could remove the function just to see if it fixes it. If that doesn't fix it, it's something else.

That is; try this:
Expand|Select|Wrap|Line Numbers
  1. $tplv['idformat'] .= $row['title'];
  2.  
And post what that does.
Sep 20 '08 #10
Punkis
12
nothing again... i am loosing my mind
:(
Sep 20 '08 #11
Punkis
12
Until 10 minutes ago, the results could not display me correctly the Greek characters from mysql.
The search system searches the title of the item which contains English and Greek characters.

I solve this problem with this :
I use notepad for any encoding i do between ansi, unicode and utf8.
I wrote into notepad the title in English and for the Greek letters i wrote them in HTML encoded characters and i saved it as ANSI.

On phpmyadmin I uploaded the file choosing utf8 for Character set of the file and ANSI for sql compatibility.

i searched for that English word i wrote in the title and displayed to me the result WITH GREEK LETTERS correctly.
This is the only way to display Greek letters. I tried everything.

The problem is :
When i searched using that Greek letters that i wrote in the title the result showed me nothing. Then i searched again using the HTML encoded characters i used for that title and i got the result with Greek letters!

Having in mind that with HTML encoded characters the system found me the result, I guess there must be a line that it will convert the Greek characters to HTML encoded characters before it gives me the results.

Anyone knows anything about this?
Sep 20 '08 #12
Punkis
12
My greek data is written in the database using the decimal format http://htmlhelp.com/reference/html40/entities/symbols.html

The only way to get the results displayed is when i search with those decimal codes.

I want to convert the greek letters that i write in the searchbox to those decimal codes before it gives me the results, with this way i will get the correct search results.
Sep 21 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
I have a problem with MySQL charsets. In many table fields I have greek characters. With phpMyAdmin & MySQL Command Center I see greek characters correct. The same from my PHP pages. When I...
27
by: alexdoulou | last post by:
Hello, I am trying to type greek fonts into common html forms on the Internet explorer but erroneous text is being typed instead of clear greek. Greek language pack is installed correctly....
9
by: PAN | last post by:
I need some guidance here I've written this HTML code using the Windows Notebook: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EL"> <html> <head> <title>This is a Greek language title ->...
8
by: John Baima | last post by:
I have an Access table that just consists of 2 columns: WordID (Autonumber, Primary key) and WordText (Text, Indexed, No dups). I've used this with a number of texts and languages without any...
4
by: imoschak | last post by:
Hi there i have a problem while parsing and xml file. The file is a backup from moodle (moodle.xml). When i open the file with one of my editors and setting Encoding to utf8 font courier standard...
0
ekekakos
by: ekekakos | last post by:
Hello, I am having a serious and urgent problem with the character settings of an oracle database. The database is sitting in a solaris unix server and when we run the env command we have the...
0
by: nass | last post by:
hello everyone and happy new year. i am not sure how to tackle this problem or where is originates from so i am writing here in hope that if you can not help you can at least point me in a...
1
by: Ryan | last post by:
Hi, I'm trying to do retrieve some data from a table where the content is in Greek, however, the query is not working. It's a very simple statement, but I'm missing something. Here is the...
6
by: starman | last post by:
Hi all, I'm having trouble trying to enter/retrieve Greek characters. I have an astronomical dbase in MySQL. As you may know, lots of sky objects have Greek letter names (alpha Centauri, etc) but I...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.