Forum Moderators: coopster

Message Too Old, No Replies

PHP/MySQL Maltese Diacritics problem

Cant insert Maltese special characters in MySQL or printed by PHP

         

Marz5

8:25 pm on May 19, 2007 (gmt 0)

10+ Year Member



Hi folks, I have a comprehensive website about the plants of Malta and I am slowly converting it to MySQL/PHP. I am doing very well until I have this problem with special Maltese characters:

[ Ċ ċ - Ġ ġ - Ħ ħ - Ż ż ]
(Unicode: 266,267 288,289 294,295 379,380)

These chrs show well with plain html but not from php if for instance I use
print 'Ċċ Ġġ'; => Cc Gg

Worse... I am converting an XLS file (.csv) with such characters into MySQL and these characters are replaced by '?' in MySQL. I tried to use different charsets of MySQL but no difference what so ever.

I'm desperate now.

Marz5

3:07 pm on May 22, 2007 (gmt 0)

10+ Year Member



Any frsh ideas please? on phpbb2.21 it was possible so I am sure there is some way or other.

cameraman

4:27 pm on May 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Marz5, I tried this:
<?php echo "Special characters: &#266; &#267; &#288; &#289; &#294; &#295;<br>\n";?>
Special characters: &#266; &#267; &#288; &#289; &#294; &#295;<br>

and produced two lines of a C with a dot, a c with a dot, a G with a dot, a g with a dot, an H with a line on its upper part and an h with a line.
Are you executing your print statement in the body of html? That is, do you have:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
print '&#266;&#267; &#288;&#289;';
?>
</body>
</html>

I can't think of any reason that the php-produced content would be rendered differently. The only thing I can think is that in your test you're sending it straight to the browser without setting it up as an html document, so the browser doesn't understand what rules to apply to display it.