Jump to content

Recommended Posts

Hi

 

I am developing a site that needs to be in 3 languages, English Italian and Spanish, the English is displayed correctly however when I change it to show Italian, some of the characters are not displayed correctly, for example the e with the accent at the top.

 

How can I get the letters to display properly regardless of language selected?

Link to comment
https://forums.phpfreaks.com/topic/268704-showing-foreign-language-letters/
Share on other sites

Make sure that you're using UTF-8 at every single step, that includes the DB and HTTP headers.

I recommend reading at least these two articles:

http://www.joelonsoftware.com/Articles/Unicode.html

http://www.ibm.com/developerworks/library/os-php-unicode/index.html

This is the code for the page

 

<?php
//include_once('includes/connect_inc.php');
if(isset($_COOKIE['lang'])){
   if($_COOKIE['lang']=='it'){
       include_once('includes/defines_it.php');
   }
   else{ include_once('includes/defines_en.php');
}
}
else{
   include_once('includes/defines_en.php');
}
?>
<?php function auto_copyright($year = 'auto'){ ?>
  <?php if(intval($year) == 'auto'){ $year = date('Y'); } ?>
  <?php if(intval($year) == date('Y')){ echo intval($year); } ?>
  <?php if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } ?>
  <?php if(intval($year) > date('Y')){ echo date('Y'); } ?>
<?php } ?>
<!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"><!-- InstanceBegin template="/Templates/covatti.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title><?php echo site_title;?></title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="css/covatti.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div align="center">
<div id="main-container">
<span id="top-nav"><?php include_once('includes/top-nav_inc.php');?></span>      
     <table width="967" border="0" cellpadding="0" cellspacing="0">
     <tr>
     <td colspan="2" id="header">
     <div id="header">
     <img src="images/logo.png">      </div>      </td>
     </tr>
     <tr>
     <td width="200">      </td>
     <td width="767">
     </td>
     </tr>
     <tr id="main_content">
     <td id="left-bar"><img src="images/nico.png" /><br />
     <?php echo screen_resolution;?>
     <script type="text/javascript"> document.write(screen.width+'x'+screen.height); </script><br/>
<?php
if(isset($_COOKIE['lang'])){
   if($_COOKIE['lang']=='it'){
?>
       <a href="rss-it.php">
   <?php }
   else{?> <a href="rss-en.php">
<?php }
}
else{?>
   <a href="rss-en.php">
<?php }
?>
<img src="images/rss.png" /></a>

     </td>
     <td id="main-content">
     <!-- InstanceBeginEditable name="main-content" -->
     <h1><?php echo contact;?></h1>
     <div align="center">
     <form>

     <?php echo fromname;?><br /><input name="name" /><br />
     <?php echo emailaddress;?><br /><input name="email" /><br />
     <?php echo reason;?><br />
     <select name="reason">
     <option selected="selected"><?php echo pleaseselect;?>...</option>
     <option value="<?php echo sponsorrequest;?>"><?php echo sponsorrequest;?></option>
     <option value="<?php echo websiteproblem;?>"><?php echo websiteproblem;?></option>
     </select><br />
     <?php echo message;?><br />
     <textarea name="message"></textarea><br />
     <?php echo humanquestion;?><br /><input name="human" /><br /><?php echo humanreason;?>
     </form>
     </div>
           <!-- InstanceEndEditable -->      </td>
     </tr>
     <tr>
     <td id="footer" colspan="2">
     <div id="footer-nav"><?php include_once('includes/footer-nav_inc.php');?></div><br />
     </td></tr>
     <tr>
     <td id="footer" colspan="2">
     <blockquote>
     <p>© <?php auto_copyright('2012'); ?> Covatti Racing</p>
   </blockquote>
   Website by <a href="http://www.bravo14.co.uk" target="_blank">Bravo14</a>      </td>
     </tr>
     </table>
</div>
</div>
</body>
<!-- InstanceEnd --></html>

 

The languages are coming from include files that contain a list of defines

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.