473,811 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Greek characters

12 New Member
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("SE T 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 9761
Atli
5,058 Recognized Expert Expert
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 New Member
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=\"".$SETTI NGS['siteurl']."item.php?id=" .$row['id']."\">";

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


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

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

The htmlspecialchar s 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 New Member
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 Recognized Expert Expert
Yea, that should work.
Does it?
Sep 20 '08 #6
Punkis
12 New Member
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 Recognized Expert Expert
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 New Member
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 htmlspecialchar s 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 Recognized Expert Expert
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 htmlspecialchar s 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

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

Similar topics

1
727
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 run the following command ------------------ mysqldump -uroot -p my_database > out.sql or
27
5605
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. Encoding for greek is OK. What is the problem?
9
14262
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 -> καρυδάς πληροφορική</title> </head> <body>
8
2130
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 problems. With my first Unicode Greek text, I've encountered a problem. The first 2 words of the text are "o(doi\ du/o". Now, those obviously are not the same words, but after I add the first, the second cannot be added because it thinks that I am...
4
679
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 or greek characters the editor can see all greek strings contained within the file perfectly. On the other hand when i try to open it with php parse it and then display it on a web page the data from the file come out like latin characters like...
0
2142
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 following in the NLS_LANG parameter: AMERICAN_AMERICA.WE8ISO8859P1 (I do not know if this is helpfull). When I retrieve data from oracle database (through a VB.NET 2005 program) to a dataset I use a special font in order to see the greek characters...
0
1444
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 direction. I am writing some little program using only standard c++ library and i am opening a file that contains strings. there are numbers , english and greek letters among the characters. the reading is done fine and the data are then stored onto a...
1
5000
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 table... if exists (select * from dbo.sysobjects where id = object_id(N'.
6
17558
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 want to enter these - and have the user see them - as the actual greek characters. Copying and pasting from character map doesn't work (if I copy the greek letter gamma, when I paste it into the field in PHPMyAdmin it comes out as "g" and likewise...
0
9605
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
10389
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...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6890
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
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.