Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-11-15
7
Medium Priority
?
546 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 1000 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
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…

719 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