• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1010
  • Last Modified:

Converting HTML Entity characters into Greek using PHP

I'm using PHP in my site. I'm saving greek characters in the form of HTML entities in a database. When I retrieve the data from the database (mySQL) the server(I guess) automatically converts those special characters into the original greek writting. Is there any other way to retrieve that data as greek? I tried the htmlentities and decode php functilons, but I could not do it (I think those default methods do not support ISO greek characters). How do I do it? Examples are required.
0
varkon
Asked:
varkon
  • 4
  • 2
  • 2
1 Solution
 
compustarsgCommented:
i think you can do it with utf-8 character encoding. set mysql to utf-8.  configure php.ini to use utf-8. enable mbstring extension in php. then you can store data in greek , also can retreive and show on web pages. need more explanation ask me.
0
 
varkonAuthor Commented:
Unfortunately, because my site is not hosted on my machine (or a machine on which I have administrative rights) I cannot make any changes in mysql or php. I've asked the server's admins but they do not allow any changes. Is there any other way?
0
 
compustarsgCommented:
basically what you need is , you should set the character encoding in mysql, php to the  encoding which can store greek language. (unicode supported encodings definetly store greek letters).  find out with the server admin what is the current configurations. if they dont support greek then as i know you can't solve this.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
varkonAuthor Commented:
Ok... I'll give it a try and get back 2u.
0
 
gruntarCommented:
There should be no problems storing greek characters (not entities) in your database.
You must use right codepage on your HTML pages.

I use Central eurpoean code page and mySQL serer is locatedin US with codepage Latin1 and I can save/ retrieve text without conversions.

Here is my meta tag   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
for greek you could use
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253" />
or
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7" />

That should do the trick.

Cheers
0
 
varkonAuthor Commented:
gruntar thanks for the tip. However, my real problem is how to convert the characters already stored in the database (as html entities) to greek. compustarsq I was not able to "convince" the server's admins to change their configuration.
0
 
gruntarCommented:
Problem is that you thought of that problem a bit to late. :|
What about this http://dev.mysql.com/doc/mysql/en/replace_utility.html

or you could create new temp table with same fields and create query like this

INSERT INTO temp_table (field1, field2)
    SELECT REPLACE(field1, '&#125;', 'ö'), REPLACE(field2, '&#125;', 'ö')
    FROM your_table;

when everything is set you just rename tables.

hope that helps.
0
 
varkonAuthor Commented:
Yeah, you are so right... I'll give it a try and let you know.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now