473,406 Members | 2,707 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,406 software developers and data experts.

Cannot display grrek text taken from XML with Javascript

mikek12004
200 100+
I have an XML and I take from it some data with javascript and diplay them, when the data are in english all fine but when in greek it shows non-understadanble symbols, tried to change the charcet from the mata tag of the page but didn't work (after all when written in HTML the greek is shown just fine) in anonther occasion I overcome the problem with the PHP function iconv() is there something similar in Javascript? or I must do something in XML.

PS not sure if I should post it in the javascript or XML section so I decided to post it here
Oct 17 '08 #1
5 1879
acoder
16,027 Expert Mod 8TB
How are you extracting the data from the XML file?
Oct 17 '08 #2
mikek12004
200 100+
through an API function of the JW PLAyer the entire code is here
(you can get a working example at
http://www.jeroenwijering.com/?page=wizard&example=24)
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.  
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Testing Title</title>
  7. <script type="text/javascript">
  8. var player = null;
  9. var currentItem = 0;
  10.  
  11. function playerReady(obj)
  12. {
  13. player = gid(obj.id);
  14. player.addControllerListener('ITEM', 'itemMonitor');
  15. player.addModelListener('STATE', 'stateMonitor');
  16. };
  17.  
  18. function itemMonitor(obj)
  19. {
  20. currentItem = obj.index;
  21. };
  22.  
  23. function stateMonitor(obj)
  24. {
  25. //...get title
  26. if(obj.newstate == 'PLAYING')
  27. {
  28. gid('title').innerHTML = 'Title:' + player.getPlaylist()[currentItem]['title'];
  29. }
  30. }
  31.  
  32. function gid(name)
  33. {
  34. return document.getElementById(name);
  35. };
  36. </script>
  37. </head>
  38. <body>
  39. <table>
  40. <tr>
  41. <td>
  42. <script type="text/javascript" src="swfobject.js"></script>
  43. <div id="player">This text will be replaced</div>
  44.  
  45. <script type="text/javascript">
  46. var width=323;
  47. var height=267;
  48. var so = new SWFObject('player.swf','mpl','323','267','9');
  49. so.addParam('allowscriptaccess','always');
  50. so.addParam('allowfullscreen','true');
  51. so.addParam('flashvars','&file=asx.xml&autostart=true&repeat=list');
  52. so.write('player');
  53. </script>
  54.  
  55. <div id="title"></div>
  56. </td>
  57. </tr>
  58. </table>
  59. </body>
  60. </html>
  61.  
The xml file is
Expand|Select|Wrap|Line Numbers
  1. <asx version="3.0" >
  2.     <title>General Music ASX playlist</title>
  3.  
  4.     <moreinfo href="http://www.emile.com"/>
  5.  
  6.     <entry>
  7.         <title>ασγ|1.00904.jpg</title>
  8.         <ref href="../player_files/videos/YouTube - 301 kai simera!(den antexw).flv" />
  9.         <moreinfo href="http://www.bigbuckbunny.org/" />
  10.     </entry>
  11.     <entry>
  12.         <title>a2</title>
  13.         <ref href="../player_files/videos/bunny.flv" />
  14.         <moreinfo href="http://www.bigbuckbunny.org/" />
  15.     </entry>
  16.     <entry>
  17.         <title>a3</title>
  18.         <ref href="../player_files/videos/YouTube - Alice Cooper - Poison.flv" />
  19.         <moreinfo href="http://www.bigbuckbunny.org/" />
  20.     </entry>
  21.  
  22.  
  23.  
  24. </asx>
  25.  
with the replaceHTML property I replace the contents of a div with the contents of the title tag of each song, since anywhere else even inside the javascript I can write greek, the problem is how to write them in the asx file I believe the problem lies there
Oct 17 '08 #3
acoder
16,027 Expert Mod 8TB
This may well be a Flash problem. Perhaps there's an option that you set using SWFobject?
Oct 17 '08 #4
mikek12004
200 100+
OK solved, I added the <?phpxml version='1.0' encoding='UTF-8'?> which I thought to be wrong since I had <asx version="3.0" > no all is fine
Thanks for your time
Oct 17 '08 #5
acoder
16,027 Expert Mod 8TB
Glad you got it working :)
Oct 17 '08 #6

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

Similar topics

1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
8
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - ...
4
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in...
6
mmarif4u
by: mmarif4u | last post by:
Hi everyone. i make a page that a user input thier icnumber with confirm ic number, it saves the data to mysql db with current date and a random access code generated automatically, NOW i have...
15
by: cssExp | last post by:
hello, Rather than going on a wild explanation on what's the the problem, it'll be much quicker and easier if i let you look at it yourself, so I'll post my page source (actual contents taken out,...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
0
by: pankajprakash | last post by:
Hi all I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.