473,419 Members | 1,842 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,419 software developers and data experts.

The XML produced by a php is not showing greek

mikek12004
200 100+
I am using this code to produce an xml file, do not pay any attetion to the queries the thing is that even if I put the UTF-8 encoding when I try to run the xml file I get the greek characters as invalid, the crazy thing is that if I open it and press enter somewhere or do any other meaningless change and save it then upload it again it works fine (I have windows XP and the server where the script resides is linux-if that plays any role)
Expand|Select|Wrap|Line Numbers
  1. $file= fopen("player/".$id.".xml", "w");
  2.             //standard headers
  3.             $xml = "<?php xml version=\"1.0\" encoding=\"ISO-8859-7\"?>\n";
  4.             $xml.="<asx version=\"3.0\" >\n";
  5.             $xml.="<title>General Music ASX playlist</title>\n";
  6.             $xml.="<param name=\"encoding\" value=\"utf-8\" />\n";
  7.             $xml.="<moreinfo href=\"http://www.gm.com\"/>\n";
  8.             for ($i=0;$i<$count;$i++)
  9.                 {
  10.                     //get info from database
  11.                     $msg2=explode("/",$msg[$i]);
  12.                     $count2=count($msg2);
  13.                     $code=$msg2[($count2-1)];
  14.                     $pos=strrpos("$code",".");
  15.                         $code=substr($code,0,$pos); //song code
  16.                     $q2= mssql_query("select clroot.Material.description , clroot.item.Code  , clroot.Material.AA ,clroot.item.AA   from (clroot.Material left join clroot.item on clroot.Material.Code=clroot.item.Code) where (  clroot.Material.Code = '$code' )");
  17.                     $r2=mssql_fetch_array($q2);
  18.                     $item2AA=$r2[3];
  19.                     $q3= mssql_query("Select clroot.item.Code from ( clroot.itemrlsn left join clroot.item on clroot.item.AA=clroot.itemrlsn.item2AA ) where(  clroot.itemrlsn.item1AA=$item2AA )");
  20.                     $r3=mssql_fetch_array($q3);
  21.                         $album_code=$r3[0]; //album code
  22.                     $q4=mssql_query("Select Description,BOMAA,Ctgry1,Ctgry2,RecCrD,AltCode,clroot.Material.Code from clroot.material where code='$album_code'");
  23.                     $r4=mssql_fetch_array($q4);
  24.                     $album_description=$r4[0]; //album description
  25.                     $album_BOMAA=$r4[1];
  26.                     $q5=mssql_query("select clroot.Material.Code from (clroot.Material left join clroot.bomLnItm on  clroot.Material.AA=clroot.bomLnItm.MaterialAA) where ( clroot.bomLnItm.BOMCode=$album_BOMAA and clroot.Material.Code >=9.0 and clroot.Material.Code <9.5 and clroot.material.ctgry4!=30)");
  27.                     $r5=mssql_fetch_array($q5);
  28.                     $singer_code=$r5[0];    //singer code
  29.                     $q5=mssql_query("Select descr from clroot.skzoom4 where id='$singer_code'");
  30.                     $r5=mssql_fetch_array($q5);
  31.                     $singer_description=$r5[0];    //singer desc
  32.                     $Qtimi= mssql_query("select retailprice,aa from clroot.material where code='$album_code'");
  33.                     $Rtimi=mssql_fetch_array($Qtimi);
  34.                     $timi1=round("$Rtimi[0]");
  35.                     if ($timi1>$Rtimi[0]) $timi1=$timi1-1;
  36.                     $timi11=stristr("$Rtimi[0]",".");
  37.                     $timi2=substr($timi11,0,3);
  38.                     if ( strlen($timi2)<3 ) $timi2=".00";
  39.                     $timi=$timi1.$timi2; //timi album
  40.                     // create xml entry
  41.                     $xml.="<entry>\n";
  42.                     $display_data=$code."|".$album_code."|".$album_description."|".$singer_code."|".$singer_description."|".$timi."|";
  43.                     $xml.="<title>".$display_data."</title>\n";
  44.                     $xml.="<ref href=\"".$msg[$i]."\" />\n";
  45.                     $xml.="<param name=\"image\" value=\"UserFiles/Image/".$album_code.".jpg\" />\n";
  46.                     $xml.="</entry>\n";
  47.                 }
  48.                 $xml.="</asx>";
  49.             //custom ones here
  50.  
  51.             fwrite($file, $xml);
  52.             fclose($file);
  53.  
an example output with thee above problem is
http://www.***.gr/player/02.xml
and the corresponding xml looks like
Expand|Select|Wrap|Line Numbers
  1. <?php xml version="1.0" encoding="ISO-8859-7"?>
  2. <asx version="3.0" >
  3. <title>General Music ASX playlist</title>
  4. <param name="encoding" value="utf-8" />
  5. <moreinfo href="http://www.gm.com"/>
  6. <entry>
  7. <title>8.01475|1.05059|ΤΑ ΡΕΜΠΕΤΙΚΑ - ΤΑ ΖΕΪΜΠΕΚΙΚΑ ΠΟΥ ΕΓΡΑΨΑΝ ΙΣΤΟΡΙΑ Νο 6|9.00117|ΜΙΧΑΛΗΣ ΔΑΣΚΑΛΑΚΗΣ|8.00|</title>
  8. <ref href="UserFiles/songs/02/8.01475.mp3" />
  9. <param name="image" value="UserFiles/Image/1.05059.jpg" />
  10. </entry>
  11. <entry>
  12. <title>8.01605|2.05008|ΕΠΙΛΟΓΕΣ ΖΕΪΜΠΕΚΙΚΑ|9.00114|ΠΑΝΑΓΙΩΤΗΣ ΜΙΧΑΛΟΠΟΥΛΟΣ|4.40|</title>
  13. <ref href="UserFiles/songs/02/8.01605.mp3" />
  14. <param name="image" value="UserFiles/Image/2.05008.jpg" />
  15. </entry>
  16. <entry>
  17. <title>8.01758|1.05043|Ο ΤΑΣΟΣ ΜΠΟΥΓΑΣ ΣΕ ΤΣΑΚΙΡ ΚΕΦΙ|9.00109|ΤΑΣΟΣ ΜΠΟΥΓΑΣ|8.00|</title>
  18. <ref href="UserFiles/songs/02/8.01758.mp3" />
  19. <param name="image" value="UserFiles/Image/1.05043.jpg" />
  20. </entry>
  21. <entry>
  22. <title>8.01858|1.05060|ΤΑ ΡΕΜΠΕΤΙΚΑ ΤΗΣ ΜΑΓΚΙΑΣ ΚΑΙ ΤΗΣ ΜΑΣΤΟΥΡΑΣ Νο 5|9.00114|ΠΑΝΑΓΙΩΤΗΣ ΜΙΧΑΛΟΠΟΥΛΟΣ|8.00|</title>
  23. <ref href="UserFiles/songs/02/8.01858.mp3" />
  24. <param name="image" value="UserFiles/Image/1.05060.jpg" />
  25. </entry>
  26. <entry>
  27. <title>8.01904|1.05060|ΤΑ ΡΕΜΠΕΤΙΚΑ ΤΗΣ ΜΑΓΚΙΑΣ ΚΑΙ ΤΗΣ ΜΑΣΤΟΥΡΑΣ Νο 5|9.00114|ΠΑΝΑΓΙΩΤΗΣ ΜΙΧΑΛΟΠΟΥΛΟΣ|8.00|</title>
  28. <ref href="UserFiles/songs/02/8.01904.mp3" />
  29. <param name="image" value="UserFiles/Image/1.05060.jpg" />
  30. </entry>
  31. <entry>
  32. <title>8.01937|1.05057|ΤΑ ΡΕΜΠΕΤΙΚΑ - ΦΡΑΓΚΟ ΔΕ Θ' ΑΦΗΣΩ Νο 4|9.00081|ΕΣΚΕΝΑΖΥ ΡΟΖΑ|8.00|</title>
  33. <ref href="UserFiles/songs/02/8.01937.mp3" />
  34. <param name="image" value="UserFiles/Image/1.05057.jpg" />
  35. </entry>
  36. <entry>
  37. <title>8.01950|1.05056|ΤΑ ΡΕΜΠΕΤΙΚΑ - ΣΟΥ ΤΑ 'ΧΩ ΜΑΖΕΜΕΝΑ Νο 1|9.00114|ΠΑΝΑΓΙΩΤΗΣ ΜΙΧΑΛΟΠΟΥΛΟΣ|8.00|</title>
  38. <ref href="UserFiles/songs/02/8.01950.mp3" />
  39. <param name="image" value="UserFiles/Image/1.05056.jpg" />
  40. </entry>
  41. <entry>
  42. <title>8.01964|1.05061|ΤΑ ΡΕΜΠΕΤΙΚΑ - ΑΠ' ΤΗ ΣΜΥΡΝΗ ΣΤΗΝ ΕΛΛΑΔΑ Νο 2|9.00080|ΚΩΣΤΑΣ ΡΟΥΚΟΥΝΑΣ|8.00|</title>
  43. <ref href="UserFiles/songs/02/8.01964.mp3" />
  44. <param name="image" value="UserFiles/Image/1.05061.jpg" />
  45. </entry>
  46. <entry>
  47. <title>8.07834|1.05058|ΤΑ ΡΕΜΠΕΤΙΚΑ - ΕΞΩ ΣΤΕΝΑΧΩΡΙΑ Νο 3|9.00126|ΑΝΘΟΥΛΑ ΑΛΙΦΡΑΓΚΗ|8.00|</title>
  48. <ref href="UserFiles/songs/02/8.07834.mp3" />
  49. <param name="image" value="UserFiles/Image/1.05058.jpg" />
  50. </entry>
  51. <entry>
  52. <title>8.08344|1.04212|ΞΗΜΕΡΩΣΕ ΚΑΙ ΠΑΛΙ ΣΤΟ ΚΑΡΑΒΑΝΙ|9.00045|ΓΙΑΝΝΗΣ ΛΕΜΠΕΣΗΣ|16.00|</title>
  53. <ref href="UserFiles/songs/02/8.08344.mp3" />
  54. <param name="image" value="UserFiles/Image/1.04212.jpg" />
  55. </entry>
  56. <entry>
  57. <title>8.09183|1.05082|ΒΟΤΑΝΑ ΚΑΙ ΚΑΝΑΒΟΥΡΙΕΣ|9.00113|ΠΑΝΟΣ ΑΡΑΒΑΝΙΤΗΣ|8.00|</title>
  58. <ref href="UserFiles/songs/02/8.09183.mp3" />
  59. <param name="image" value="UserFiles/Image/1.05082.jpg" />
  60. </entry>
  61. </asx>
  62.  
any help?
Oct 31 '08 #1
1 3682
Dormilich
8,658 Expert Mod 8TB
you could give utf8_encode() a try if you want to use utf8. then you should declare your xml utf8 too. (but I don't know if it helps, because I don't know which charset your mssql returns)
Oct 31 '08 #2

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

Similar topics

2
by: Kyle | last post by:
Got a tough one here for you SQL junkies. I'm working on a website (in ASP) for a national greek/college organization. All it's college chapters have greek chapter names, i.e. Alpha Chapter,...
27
by: alexdoulou | last post by:
Hello, I am trying to type greek fonts into common html forms on the Internet explorer but erroneous text is being typed instead of clear greek. Greek language pack is installed correctly....
9
by: PAN | last post by:
I need some guidance here I've written this HTML code using the Windows Notebook: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EL"> <html> <head> <title>This is a Greek language title ->...
4
by: Kiki | last post by:
Hello, I'm trying to find a way to display text in greek or cyrillic in a .NET page using text stored in XML format. I'm getting the greek words displayed like this: "ÄéÜöïñá". I'm no expert but...
1
by: interuser | last post by:
Hi I have a web app that has a webpage on which there is a textbox and a submit button. if I type greek and press submit, the greek does not go through to the webserver. If I type greek and...
6
by: pros | last post by:
Hi, I am new to learning how to program in JavaScript and want to design a program in JavaScript that will allow a user to run a Classical Greek vocabulary flashcard program on my web page. My...
6
by: starman | last post by:
Hi all, I'm having trouble trying to enter/retrieve Greek characters. I have an astronomical dbase in MySQL. As you may know, lots of sky objects have Greek letter names (alpha Centauri, etc) but I...
2
by: rsam2011 | last post by:
Hi there, I have a strange problem with an application running on Windows 2000 connecting to a SQL Server 2000 with Greek collation. Runnin this query on the SQL "SELECT...
12
by: Punkis | last post by:
Hi all, I have a problem with my php and mysql project. I use an auctions software, named phpauction for my project. I import into my database with utf8 encodingm and I can see the greek...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.