Solved

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

Posted on 2007-11-15
7
509 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now