A charset problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Waxxy
Forum Newbie
Posts: 4
Joined: Wed Mar 12, 2008 11:26 am

A charset problem

Post by Waxxy »

Problem solved, thank you!
Last edited by Waxxy on Thu Mar 13, 2008 9:44 am, edited 1 time in total.
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Re: A charset problem

Post by andym01480 »

You need to set it in the headers of the html/xhtml output

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></meta>

Change iso-8859-1 to what you want!
Waxxy
Forum Newbie
Posts: 4
Joined: Wed Mar 12, 2008 11:26 am

Re: A charset problem

Post by Waxxy »

that does not work. That was the first thing what i have done.
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Re: A charset problem

Post by andym01480 »

You haven't done it in the headers!
View-source looks like this

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></meta>
 
<form action="translation.php" method="post" name="translate">
  <p>Russian</p>
  <p>
    <textarea name="translate" cols="45" rows="5" value=""></textarea>
  </p>
  <p>English</p>
  <p>
    <textarea name="textarea2"  cols="45" rows="5" value ="'.$english.'"></textarea>
</p>
</form>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
There are no headers there!
You want something like

Code: Select all

<!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">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></meta>
<title>Translation page</title>
</head>
<body>
Then output your stuff
</body>
</html>
You've also not done the textarea right

Code: Select all

 <textarea name="textarea2"  cols="45" rows="5" value ="'.$english.'"></textarea>
Should be

Code: Select all

echo '  <textarea name="textarea2"  cols="45" rows="5">'.$english.'</textarea>';
and the same for the Russian bit!
Post Reply