Jump to content

[SOLVED] PHP MYSQL Flash Character Problem


siezma

Recommended Posts

Hello,

I have a big problem with turkish characters ("ıüğöçş"). I am designing a video sharing script. First of all, the script gets the latest video info from mysql and write it into playlist.xml, and then flash video player reads the data from xml and shows it. However there is a problem with php generated xml files. When i use notepad and save it,everything works fine, but when php creates the xml file, strange characters appear.

 

My;

MySQL charset: UTF-8 Unicode (utf8)

MySQL connection collation: utf8_unicode_ci

 

PHP Code is below;

 

//XML PLAYLIST START
$xml_playlist="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";	
$xml_playlist.="<FLV_PLAYLIST Refresh=\"40\" Sequence=\"order\">\r\n";
$xml_playlist.="\t<DESCRITPTION Name=\"Name\" Value=\"\" />\r\n";
$xml_playlist.="\t<DESCRITPTION Name=\"Rating\" Value=\"Puan:\" />\r\n";
$xml_playlist.="\t<DESCRITPTION Name=\"Authour\" Value=\"Kullancı:\" />\r\n";
$xml_playlist.="\t<DESCRITPTION Name=\"Views\" Value=\"İzlenme:\" />\r\n";
$sql="SELECT videos.video_id,videos.indexer,videos.title AS Name,videos.updated_rating AS Rating,videos.number_of_views AS Views,member_profile.user_name AS Author FROM videos LEFT JOIN videocomments ON videos.video_id=videocomments.video_id LEFT JOIN member_profile ON
videos.user_id=member_profile.user_id WHERE videos.approved='yes' AND videos.public_private = 'public' ORDER BY videos.indexer LIMIT 20";
$result=mysql_query($sql);
$num_rows=mysql_num_rows($result);	
for($i=0;$i<$num_rows;$i++){
	$row=mysql_fetch_array($result,MYSQL_ASSOC);
	$video_id=$row['video_id'];
	$name=$row['Name'];
	$rating=$row['Rating'];
	$views=$row['Views'];
	$author=$row['Author'];
	$indexer=$row['indexer'];
	$xml_playlist.="\t<VIDEO Name=\"$name\"  Authour=\"$author\"  Rating=\"$rating\" Comments=\"$comments\" Views=\"$views\"  Thumbnails=\"/uploads/thumbs/$video_id.jpg\"  url=\"play.php?vid=$indexer\" target=\"_self\"/>\r\n";									
}
$xml_playlist.="</FLV_PLAYLIST>";
//Writing the xml data in the playlist.xml
$file= fopen("playlist.xml", "w");	
fwrite($file, $xml_playlist);
fclose($file);	

 

Please help!!!

Thanks

 

 

Link to comment
Share on other sites

Btw, i forgot to mention. If i change the encoding of XML from "UTF-8" to "windows-1254". The browser shows xml and flash doesn't recognize turkish characters, but when i keep it as "UTF-8".,The browser doesn't show xml as valid and flash still doesn't recognize the characters(When i edit the xml file in notepad as UTF-8, eveything works fine ).SSDS :'(.

 

 

The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'playlist.xml'. Line 8, P...

<VIDEO Name="Hesapla



 

EXTRA INFO

------------

PHP Version 4.4.7

MYSQL Version 4.1.21

Operating System is Linux

 

I wanted to give you as much info as possible. I hope somebody has knowledge to solve it. I am tired of this error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.