LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 08: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, 08: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:47 PM
[SOLVED] MySQL, UTF-8 and accented characters Tinkster Linux - Software 15 02-03-2010 11:45 AM
How to input non-utf characters from utf-8 linux enviroment? jadas Linux - General 6 02-07-2009 04:20 PM
How to enable UTF-8 characters displaying correctl OpenSuse 10.2 ?y bubaka Suse/Novell 1 07-23-2007 05:45 PM
Displaying Japanese characters gjarman Linux - Newbie 0 05-01-2003 02:52 AM


All times are GMT -5. The time now is 09:29 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration