Bluehost.com Web Hosting $6.95

Strange characters in MYSQL?

This is a discussion on Strange characters in MYSQL? within the MySQL Database forums, part of the Database Forums category; The following string: "US generals ‘will quit’ if Bush orders Iran attack" is being stored in my table ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-20-2007
matthud@gmail.com
 
Posts: n/a
Default Strange characters in MYSQL?

The following string:
"US generals ‘will quit’ if Bush orders Iran attack"

is being stored in my table as:

"US generals ‘will quit’ if Bushorders Iran attack"

The only PHP function I'm applying to the string is
mysql_real_escape_string, and that doesn't appear to be the root of
the problem. I'm using utf8_general_ci as my collation.

Forgive my ignorance.

Reply With Quote
  #2 (permalink)  
Old 03-20-2007
J.O. Aho
 
Posts: n/a
Default Re: Strange characters in MYSQL?

matthud@gmail.com wrote:
> The following string:
> "US generals ‘will quit’ if Bush orders Iran attack"
>
> is being stored in my table as:
>
> "US generals ‘will quit’ if Bush orders Iran attack"


Thats how an UTF-8 string looks like when displayed with ISO8859-1.

--

//Aho
Reply With Quote
  #3 (permalink)  
Old 03-22-2007
Dikkie Dik
 
Posts: n/a
Default Re: Strange characters in MYSQL?

> "US generals ‘will quit’ if Bush orders Iran attack"
> is being stored in my table as:
> "US generals ‘will quit’ if Bush orders Iran attack"
>
> The only PHP function I'm applying to the string is
> mysql_real_escape_string, and that doesn't appear to be the root of
> the problem. I'm using utf8_general_ci as my collation.


If you view the page in your browser, check if the browser selects utf-8
("view" menu under IE and firefox). If not, then you can either convert
the string (using the mb_string functions, for instance), or use utf-8
in both php and MySQL. You can set the encoding in PHP.INI. In MySQL,
check the output of:
SHOW VARIABLES LIKE 'char%'

Best regards
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0