View Full Version : charset problem

02-28-2007, 07:53 AM
I am having charset problem at the moment, if i try:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
some of the character which are in Tarkish language don't work
and if i use
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

others don't work.

I even tried:


any help

02-28-2007, 08:08 AM
The source files from which the copy came from also have to be utf-8 for the chars to display properly. Try changing the charset to the same as the source.

You need to convert the copy to utf-8 at some stage though.

02-28-2007, 11:46 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
echo utf8_encode ("Peşin alışverişlerinize <font color=\"ff0000\">%10 indirim</font> uygulanmaktadır.");


Pesin alisverislerinize %10 indirim uygulanmaktadir.

Can i get something as its input in utf-8?

02-28-2007, 06:00 PM
Specifying that the document is of the UTF-8 character set alone is not sufficient. You also need to save the document as a UTF-8-encoded document. Since you're using PHP, this means that you also need to save it as a UTF-8 document without an invisible byte order mark (BOM); PHP fails if a BOM character is present.

An example of a program that saves as UTF-8 with the BOM is Microsoft Notepad, and an example of a program that does not is Adobe GoLive. I'm not sure of other editors that can save without a BOM; best to probably attempt a Web search for them.

Once you've encoded the document correctly, you should be able to type any character from any character set directly into the document.

02-28-2007, 08:21 PM
...I agree with meth and Arbitrator.

I don't think that you can get it to work with utf_encode(). This function assumes that the argument is ISO-8859-1 encoded. And since 'ş' is not represented in this character set, the function would never convert a character to the utf-8 encoded version of the 'ş'-character.

If this was the only reason why you invoked php, then you should instead insert the text directly within the HTML without using php.