Solved

String is cut out and shows question marks instead of french characters

Posted on 2007-11-15
7
520 Views
Last Modified: 2010-04-21
I need help,, why does the description of a product in my online store cuts out to 150 chars and the French characters are replaced by questions marks????  I need your help to fix this bug!

if (strlen($produits[$x][5]) > 0){
print "<FONT style=\"font-size: 8pt\" face=\"arial, helvetica\" COLOR=\"#004A8D\">Description : </FONT><FONT style=\"font-size: 8pt\" face=\"arial, helvetica\" COLOR=\"#004A8D\">" .$produits[$x][5]."</FONT><BR>";
}

The real string:
(#401) Aprennez la programmation HTML pour concevoir des sites Webs. Préalables : connaissances pour utiliser un système d`exploitation ou posséder les compétences équivalentes.

shows:
Description : (#401) Aprennez la programmation HTML pour concevoir des sites Webs. Pr?alables : connaissances pour utiliser un syst?me d`exploitation ou poss?der le

not good...   help guys, this project for my boss is urgent I I really dont know what to do about his!



*update*   LLLOLLL even the expert exchange site is messing up the French characters!! look at all those ÃÂÂÂÂ  LLLOLLL

anyways I really would appreciate your help ,

 ;-)

0
Comment
Question by:Terminator4
  • 4
  • 3
7 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20292539
Make sure your charset is correct on your html?

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20292570
also when you are retrieving the text from the database make sure you use "SET NAMES utf8" or whatever your encoding for french characters is.
$conn = mysql_connect("localhost","smthng","smthngelse");
if (!$conn)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("test", $conn);
mysql_query('SET NAMES utf8',$conn);
// IMPORTANT HERE..
 
// etc...
}

Open in new window

0
 

Author Comment

by:Terminator4
ID: 20298527
I tryed, it does not work.

utf8 does not seem to work heres my SQL:

SET NAMES 'utf8';
SET CHARACTER SET utf8;
DROP TABLE IF EXISTS `produits`;
CREATE TABLE `produits` (
  `photojpg` varchar(50) character set utf8 collate utf8_unicode_ci NOT NULL default '',
  `prix1` decimal(12,2) NOT NULL default '0.00',
  `prix2` decimal(10,2) NOT NULL default '0.00',
  `prix3` decimal(10,2) NOT NULL default '0.00',
  `prix4` decimal(10,2) NOT NULL default '0.00',
  `description` varchar(350) character set utf8 collate utf8_unicode_ci NOT NULL,
  `nom` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL,
  `cat` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL,
  `poids` float default NULL,
  `document` varchar(50) character set utf8 collate utf8_unicode_ci NOT NULL default '',
  `format` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
  `grandeur` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default '',
  `couleur` varchar(100) character set utf8 collate utf8_unicode_ci NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:Terminator4
ID: 20298539
I realise that the proble is in MySQL,  when I direcly go into PhpMyAdmin ths problem is there when I execute querys directly

0
 

Author Comment

by:Terminator4
ID: 20299052
ok I found the problem myself

I must use latin1

thanks guys, you did speed up my search for a answer.

a+

0
 

Author Closing Comment

by:Terminator4
ID: 31409437
i found the answer myself
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20302443
glad to help :)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question