Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP - diamond question mark

Posted on 2010-09-02
6
Medium Priority
?
511 Views
Last Modified: 2013-12-13
PHP/MySQL app.  Some data coming back as the diamond question mark.

How to eliminate?
0
Comment
Question by:carsRST
[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
6 Comments
 
LVL 2

Accepted Solution

by:
IngCharlie earned 800 total points
ID: 33589626
Check encoding on your database connection and your php script

After You connect to the database set the connection encoding here's an example:

            switch ($site_encoding)
                  {
                        case("cp1250_general_ci"):
                            mysql_query("SET character_set_client = cp1250 ");
                            mysql_query("SET character_set_results  = cp1250 ");
                            mysql_query("SET collation_connection = cp1250_general_ci");      
                        break;
                        case("latin2_czech_cs"):      
                              mysql_query("SET character_set_client = latin2 ");
                              mysql_query("SET character_set_results  = latin2 ");
                              mysql_query("SET collation_connection = latin2_czech_cs");
                        break;      
                        default:
                                 mysql_query("SET character_set_client = utf8 ");
                            mysql_query("SET character_set_results  = utf8 ");
                            mysql_query("SET collation_connection = utf8_slovak_ci");
                        break;      
                  };
0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 total points
ID: 33589683
That is usually a character set / encoding mismatch between the data and the page that displays it.  You need to make sure that they are the same.
0
 
LVL 3

Assisted Solution

by:swesluggo
swesluggo earned 800 total points
ID: 33589706
kinda hard to say, but im guessing either the the encoding in your presentation layer (probably your browser) or in your db is wrong.. to switch in your browser you just select something like page > encoding > unicode/utf8 or whatever it calls it. if its in your db you need to convert the field(s) that are returning funky data.. this is done by first changing them into binary and then switching to utf-8 (which cover most chars) eg
alter table <tabkename> modify <columnname> binary(<fieldsize>);
alter table <tablename> modify <columnname> <fieldtype>(fieldsize>) character set utf8;
0
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.

 
LVL 3

Expert Comment

by:swesluggo
ID: 33589722
damn phone.. now i was late again!
0
 
LVL 16

Author Comment

by:carsRST
ID: 33590715
encoding in the database says "latin1"

Do I put this in my PHP connection code?

mysql_query("SET character_set_results  = latin1 ");
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33591900
What the character set for the page that you're displaying it on?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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