Solved

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

Posted on 2007-11-15
7
524 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

828 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