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

Greek Letters Problem: Help for Suggestions:

Hi All,

I have an Editor through which I want to send Greek Symbols for which I am using &#913 etc representation.
I have an HTML template page where this Editor is called.
Through MOOTOOLs ajax function, I am sending it to PHP which inserts the content of the Editor into MySQL Database.
The problem:
Then I have to retrieve the content. On retrieval, the Symbols are lost - I mean they are not shown as symbols but some gibberish/ gobblygook characters.

I read couple of forums: They say it is Character Set problem. I tried these things:

changed the <meta tag content type > to "UTF-8" in HTML file.
Editor Content is encoded before sending to PHP. Ajax function of Mootools is by default - UTF-8
Till this point, the symbols are seen correct - as seen in the firebug tracker on firing ajax request.
In PHP - I use HTMLEntities function and encode , then add slashes using addslashes.
Then - I send the content to MYSQL. where I have used specific - set names utf-8 and
set character set UTF-8 as well.

I hope I am doing the right thing.
When I started retrieving the content, I use stripslashes, then html_entity_decode , then via ajax, gets back to the editor where it is again decoded.
At this point, the characters have lost their meaning - they are some thing else. no more symbols.

Where am I going wrong ? This seems to be a common problem. I read the earlier posts as well, but I could not get a concrete solution. So I tried all that was available as suggestions. but to no use.

for testing : http://sgwiki.sdsc.edu,
login: guest
password: guest123

browse and pick any name listed and start editing for example : Abstract. Enter symbols using the 'a' icon in the editor tool bar.
publish it you will see the problem.
Any suggestions will be greatly appreciated.

Thank you very much.
Prasad.
Feb 23 '10 #1
4 3405
johny10151981
1,059 1GB
did you tried
mysql_real_scape_string other then addslash?

I have also faced a wiered problem in MySQL 5. I have to work with japanese character set. The problem is with the column(entity) encoding. If it is set to EUC and send data as SHIFT_JIS data get destroyd and same thing happen while column encoding is declared as SHIFT_JIS and save EUC data. I think you should also check the "Collation" of column.
Feb 23 '10 #2
Atli
5,058 Expert 4TB
@burrashiva
Do you set the third parameter of htmlentities?
It's a common error to forget that. (I forget it all the time xD)

If that's not it, could you perhaps post the relevant code snippets here? It would be easier to spot any problems that way.
Feb 23 '10 #3
Hi ,
Sorry for the delayed reply. But here are my trials after taking your suggestions. I thought better I post the code snippets.

While going into the Mysql from Client:

In the javascript:
var qstr = "editorid="+mymythis.editorid+"&content="+urlencod e(stringcont);

Probably mootools request does encoding again (whats the influence of that I have no clue) but by default the encoding while AJaX request - its encoded.

After reaching PHP:
$tablecont = addslashes( htmlentities(trim($_POST['content']),ENT_QUOTES, "UTF-8") );

@johnny... did you mean to replace addslashes with mysql_real_escape_string function??? Will try after I get a reply to this ..

before inserting into the Database:
$mm = new WadaMysql();
$mm->query('use sgmpv2');
$mm->query('SET NAMES utf8');
$mm->query("SET CHARACTER SET 'utf8'");

This saves the content as : for alpha beta and gamma :
&beta;&alpha;&gamma;

Now the retrieval code:

before connecting to mysql:
$mm = new WadaMysql();
$mm->query('use sgmpv2');
$mm->query('SET NAMES utf8');
$mm->query("SET CHARACTER SET 'utf8'");

in PHP:
echo utf8_encode(html_entity_decode(stripslashes($row['content']),ENT_QUOTES,"UTF-8"));

Then the ajax default - may be it decodes or keeps encoding - I dont know.

Once it reaches the client:
urldecode(responseText);

the javascript urldecode and urlencode are downloaded from phpjs.

any suggestions , pl. help.
Prasad.
Feb 23 '10 #4
WooooooooW!!

Okay, after all that, I just removed the the
UTF8_encode, html_entity_decode functions while retrieving the content.

It seems to be showing the symbols correctly.

Am I doing correctly?
pl give your suggestions?
I feel there may be some security lapses because of removing these functions..I dont know. Pl. enlighten on that aspect too.

Thank you very much for the help.
Prasad.
Feb 23 '10 #5

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

Similar topics

3
by: sharma | last post by:
Hi, I have a application which shows the content in two different languages English and Russian. It has Languge folder where in it maintains seperate language folders named English and Russian....
5
by: Vangelis Natsios | last post by:
I'm trying to provide a case-insensitive search in greek texts from a jsp page. The check goes like this: if (el_title.toUpperCase().indexOf(selected_title.toUpperCase()) { .... } where...
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 ->...
5
by: michael.s.gilbert | last post by:
hello all, this message is geared toward those of you in the scientific community. i'm looking for a python plotting library that can support rendering greek symbols and other various characters...
2
by: Dave | last post by:
Can someone tell me how to add Greek letters to a string? In this case I need to add the Greek letter mu to a string for display on the screen and don't know how to do it. Thanks in advance for...
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...
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...
12
by: Punkis | last post by:
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...
2
by: Benx | last post by:
Hello, I have to display a mixed letters greek and latin like: "alpha" ursa major, "beta" centauri, "delta" velorum, "epsilon"....., need help to do it. Thank's
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.