LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-08-2011, 07:17 AM   #1
goossen
Member
 
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224

Rep: Reputation: 41
PHP not displaying utf-8 characters from mysql


Here is the situation:

I have a mysql database using utf8_unicode_ci collation and a PHP page with UTF-8 encoding.
The problem is that the info comming from the database is not correctly displayed (it shows "?" for some spanish characters). But the ones (same character) I write directly in the PHP file are showing OK.
 
Old 02-08-2011, 07:32 AM   #2
goossen
Member
 
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224

Original Poster
Rep: Reputation: 41
Solved by adding
Code:
mysql_set_charset('utf8',$link);
as the first query after connect.
 
  


Reply

Tags
encoding, mysql, php, utf8



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UTF-8: russian characters not rendered correctly rblampain Debian 2 07-19-2010 11:47 AM
[SOLVED] MySQL, UTF-8 and accented characters Tinkster Linux - Software 15 02-03-2010 10:45 AM
How to input non-utf characters from utf-8 linux enviroment? jadas Linux - General 6 02-07-2009 03:20 PM
How to enable UTF-8 characters displaying correctl OpenSuse 10.2 ?y bubaka SUSE / openSUSE 1 07-23-2007 04:45 PM
Displaying Japanese characters gjarman Linux - Newbie 0 05-01-2003 01:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration