User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,975 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,631 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 321 | Replies: 1
Reply
Join Date: May 2008
Posts: 10
Reputation: flashyflashy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
flashyflashy flashyflashy is offline Offline
Newbie Poster

Php and database problem in outputting russian language properly

  #1  
Jul 5th, 2008
Hi I'm using the 2 pieces of code typed below to set the character set to utf8 (so that I can output russian characters on page, and then to output it on web pages. I have tried to set the character set to utf8 so that russian characters appear properly but I still see russian characters as ?????.




First piece of code that i have used to set the character set to utf8 so that russian language characters appear properly on page.

if (function_exists('mysql_set_charset') === false) {
function mysql_set_charset('utf8', $link = null)
{
if ($link == null) {
return mysql_query('SET CHARACTER SET utf8');
} else {
return mysql_query('SET CHARACTER SET utf8', $link);
}
}
}

and this is how I have used the function above in my coding.
$lang_cat_title_table=mysql_set_charset('utf8')
Is there something wrong in this code..??

If you know any other way to retrieve russian character from database please share your trick,that would be helpful,Thanks
Last edited by flashyflashy : Jul 5th, 2008 at 3:20 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: Argentina
Posts: 76
Reputation: martin5211 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 6
martin5211's Avatar
martin5211 martin5211 is offline Offline
Junior Poster in Training

Re: Php and database problem in outputting russian language properly

  #2  
Jul 9th, 2008
Revise your mysql database properties is set to utf8 and utf8_bin collation, then take a look at the table structure if it is utf8 and utf8_general_ci collation is selected too.

Finally, inside the html layout, the meta 'content-type' must be stand as utf-8 charset to handle these characters.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 8:03 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC