473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Getting ???? while reading data from database which is in utf8_unicode_ci

245 100+
Hi experts,
I have developed a website which is in russian language. I have integrated wordpress blog in it for news section. When i read the data from the database in my custom php page then it shows "?????" instead of showing russian characters. The wordpress database is in utf8_unicode_ci. When i post a news then it saves data in utf8_unicode_ci But when i read this data in my custom php page ( not in the wordpress template) then it shows "???????" instead of showing russian characters. Can some one guide me how can i do that. Here is my code which i am using to get the post content from the database.

Expand|Select|Wrap|Line Numbers
  1. $qs="select * from wp_posts where post_status='publish' order by ID desc limit 2";
  2. $rs = $db->Execute($qs);
  3. if($rs->RecordCount()>0){
  4. while(!$rs->EOF){
  5. $count++;
  6. <li>
  7. <p class="message">
  8. <span><?php echo $rs->fields('post_title');?></span><br />
  9. <?php echo substr($rs->fields('post_content'),0,150).'...!<br /><a href="'.$rs->fields('guid').'">Continue Reading</a>';?>
  10. </p>
  11. <div class="clear"></div>
  12. </li>
  13.  
Nov 18 '11 #1
3 2248
dlite922
1,584 Expert 1GB
Does your (X)HTML header look like this?
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  5. <head>
  6. <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
  7.  
change xml:lang="en" or "ru"?

and make sure you have charset=UTF-8 and the header as a meta tag.

You can also set it with php using header and content-type; charset http operators.

Dan
Nov 18 '11 #2
neovantage
245 100+
No it's xhtml 1.0
here is the format

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <base href="<?php echo PATH;?>" />
  5.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.  
I changed en to ru but even then it wont work.....
Nov 19 '11 #3
make sure you are using correct character encoding in the browser too.
Nov 20 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dariusz | last post by:
I have PHP code (below) which reads data from a MySQL format database. The problem I am having is trying to find out when the last ID entry was made. When the script is executed, the $gbID is...
2
by: Dariusz | last post by:
Below is part of a code I have for a database. While the database table is created correctly (if it doesn't exist), and data is input correctly into the database when executed, I have a problem...
0
by: Andy | last post by:
Hi, In the code below (not pretty I know but it's an early version :-P) I'm having problems reading the data object back in. If I move the reading code to immediately after the section where it...
4
by: projecktzero | last post by:
Well, I've managed to get an image into a postgre database, but now I'm having trouble getting it out. #! /usr/bin/env python from pyPgSQL import PgSQL def main(): connectdb =...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
1
by: PawelR | last post by:
Hi group, Sorry my English is very little I've question about reading data from database. In sql2k I've table (50k+ records). Commerce application writing to this table same data (up to 5 records...
2
by: Jake_adl | last post by:
Is there any way to create a Microsoft.Practices.EnterpriseLibrary.Data.Database object without reading from a configuration file? I am writing a utility that manages databases in SQL Server....
0
by: Boris9577 | last post by:
Hello everyone, I need help with reading data from database. I am working with Visual C++ and MS SQL 2005. This is the problem: I have tried to read some values from data base (on a way described...
0
by: makTSPL | last post by:
Dear All, I am developing an application in C#. This application communicates with Garmin Forerunner device. I have developed a demo for it, which shows Device software version. but I am not able to...
1
by: =?Utf-8?B?U2hlZXMgQWJpZGk=?= | last post by:
I read an article on the link: http://support.microsoft.com/default.aspx?scid=kb;en-us;306572 related to reading data from Excel using OLEDB The topic's heading is: How to query and display excel...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.