Solved

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

Posted on 2007-11-15
7
541 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

630 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