| | |
Problem with Greek characters
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
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.
Thank you.
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.
Thank you.
Check what encoding you have set for your web page, If it is Latin 1 (ISO-8859-1) then the Greek characters will not be displayed.
You could check for without touching you code by browsing to your page and then (in Firefox 3) go to View -> Character Encoding and select UTF-8 since thats what it seems you are using, If the characters display correctly then you will just need add the following tag in the head section of all your HTML pages:-
So that all the browsers treat it by default as a UTF-8 encoded page
You could check for without touching you code by browsing to your page and then (in Firefox 3) go to View -> Character Encoding and select UTF-8 since thats what it seems you are using, If the characters display correctly then you will just need add the following tag in the head section of all your HTML pages:-
html Syntax (Toggle Plain Text)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
Last edited by stephen84s; Sep 18th, 2008 at 2:56 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
"How to ask questions the smart way ?"
"How to ask questions the smart way ?"
Hi Punkis,
character encoding mismatch can be a nightmare.
The database, tables and attributes all have charset and collation. Make sure it's set to UTF8 and utf8_general_ci (or utf8_your_language_code).
Then you need to make sure that you select a character set both when importing into and when reading from the database. You "SET CHARACTER SET utf8" or "SET NAMES utf8" - NAMES will set collation to default for given character set which may or may not be good for you (not if you used utf8_your_language_code).
Also, sometimes you think the data you import is in UTF8 while in fact, it isn't which adds even more fun into the game :-)
You can be sure that mysql_select_db() certainly is somewhere in your application. It wouldn't work without it.
http://dev.mysql.com/doc/refman/5.0/en/charset.html
(This is for MySQL 5, look around for other versions if you're running a different version.)
character encoding mismatch can be a nightmare.
The database, tables and attributes all have charset and collation. Make sure it's set to UTF8 and utf8_general_ci (or utf8_your_language_code).
Then you need to make sure that you select a character set both when importing into and when reading from the database. You "SET CHARACTER SET utf8" or "SET NAMES utf8" - NAMES will set collation to default for given character set which may or may not be good for you (not if you used utf8_your_language_code).
Also, sometimes you think the data you import is in UTF8 while in fact, it isn't which adds even more fun into the game :-)
You can be sure that mysql_select_db() certainly is somewhere in your application. It wouldn't work without it.
http://dev.mysql.com/doc/refman/5.0/en/charset.html
(This is for MySQL 5, look around for other versions if you're running a different version.)
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
thank you all for your replies.
I have proceed to a next stage now.
for stephen84s :into this progject, i have several departments that uses different databases.in one of them, that i do my tests, i did what you tell me.
my browser has for chractet encoding greek (windows-1253) i changed it to utf8 and i get question marks instead of greek letters. (the data are from mysql). that means that my page encoding isnt utf8 right?
to petr.pavel
My mysql charset is UTF8 and i changed the colation from latin_swedish (it was default) to utf8_general_ci and set the collation of the current table-field that contains the greek letters to utf8_general_ci.
Then i imported from a text file the queries i want to add.
The result is that there are no question marks, but wherever there is a greek letter is now invisible.
i feel that i get close.
thank you
I have proceed to a next stage now.
for stephen84s :into this progject, i have several departments that uses different databases.in one of them, that i do my tests, i did what you tell me.
my browser has for chractet encoding greek (windows-1253) i changed it to utf8 and i get question marks instead of greek letters. (the data are from mysql). that means that my page encoding isnt utf8 right?
to petr.pavel
My mysql charset is UTF8 and i changed the colation from latin_swedish (it was default) to utf8_general_ci and set the collation of the current table-field that contains the greek letters to utf8_general_ci.
Then i imported from a text file the queries i want to add.
The result is that there are no question marks, but wherever there is a greek letter is now invisible.
i feel that i get close.
thank you
Last edited by Punkis448; Sep 18th, 2008 at 9:45 am.
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
i did what you told me, but i didnt come to a solution. I googled and find out that there are so many users who did the same thing without a change. There must be something i do not do right.
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
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
•
•
•
•
When I import to mysql i do it from a notepad file that i save it to *****.sql
Can you post here the script you use for importing? Maybe the problem is there.
Also, when you import, export it using phpMyAdmin and again, change the extension to .html, open in FF/MSIE, set encoding to verify that the import is ok.
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
Thank you petr.pavel for your support
1. I saved the following
to a html file. 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.
2. 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 )
1. I saved the following
to a html file. 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.
MySQL Syntax (Toggle Plain Text)
INSERT INTO `PHPAUCTIONXL_auctions` (`id`, `user`, `title`, `starts`, `description`, `pict_url`, `category`, `minimum_bid`, `reserve_price`, `buy_now`, `auction_type`, `duration`, `increment`, `location`, `location_zip`, `shipping`, `payment`, `international`, `ends`, `current_bid`, `closed`, `photo_uploaded`, `quantity`, `suspended`, `private`, `relist`, `relisted`, `num_bids`, `sold`, `shipping_terms`, `bn_only`, `adultonly`) VALUES('5227', '5', 'Αρχίδια ΑΡΧΙΔΙΑ βραστά VSX-AX5AI-S PIONEER', '20080905000444', '<a target="_blank" href="http://www.atsidas.gr/Product.aspx?ID=28&MenuID=27">View more info for this item</a>', 'http://www.atsidas.gr/ProductImages/0301000405s.jpg', '214', '0.00', '0.0000', '1100,00', '2', '55555555', '0.0000', 'Greece', 'NA', '2', 'By Mail\\nPaypal\\n', '1', '20240905173628', '0.0000', '0', '0', '1', '0', 'n', '0', '0', '0', 'n', 'none', 'n', 'n');
2. 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 )
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Help with WriteLine and Font Change (VB.NET)
- font problem (HTML and CSS)
Other Threads in the MySQL Forum
- Previous Thread: join 2 tables with no common fields
- Next Thread: SQL Injection
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






