You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Single quote - again! Created Jun 4, 2009

This thread is solved

Views: 4506     Replies: 11     Last reply Dec 15, 2009  
You must login first before you can use this feature

vashkenazy

Posts: 6

Registered:
Jun 1, 2009

Single quote - again!

Posted: Jun 4, 2009

Hello all.

I noticed trying to pass file names with SINGLE QUOTE to flowplayer playlist dosn't work. It actually breaks playlist object.
I tried with escape chacter and with "%2B" sequence, but no luck.

Any help appreciated.

Thanks.

PaulOgilvie

Posts: 61

Registered:
Feb 15, 2009

» Single quote - again!

Posted: Jun 16, 2009

Reply to: Single quote - again!, from vashkenazy
Please provide an example.

vashkenazy

Posts: 6

Registered:
Jun 1, 2009

» » Single quote - again!

Posted: Jun 17, 2009

Reply to: » Single quote - again!, from PaulOgilvie
Here is the page. I am trying to dinamically load a playlist with all mp3s contained in a specific folder, using the proper filesystem objects.
In detail, that page tries to read all mp3 files and builds a javascript array, then pass that object as playlist parameter to the flowplayer library.
But problem occurs when the filename contains special characters, like &,+,-,single quote,... and so on. For certain characters I solved with replace function (& transformed to &26), but it does not work for +,-, & and single quote
Is there a way to bypass this?

Just replace the word "quote" with the single quote symbol.
I'm forced to do this because single quote generate problems to forum as well...


<% @Page Language="VB" %>
<% @Import Namespace="System.Web.UI" %>
<% @Import Namespace="System.IO" %>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <script type="text/javascript" src="flowplayer-3.1.1.min.js"></script>
 <title>Flowplayer test</title>
</head>
<body>
 <div id="page">
  <h1>Flowplayer</h1>
  <div style="display:block;width:400px;height:80px" id="player"></div> 
  <script language="javascript">
      var mylist=new Array() ;
      var j=0;
      var temp=quotequote;
  </script>
  <% Dim di As DirectoryInfo = New DirectoryInfo("m:7")
            Dim CodedURL as string
            For Each fi As FileInfo In di.GetFiles()
                 If fi.Extension=".mp3" Then
                 CodedURL=replace(fi.name,"'","quote")
%>
        <script language="javascript">
            temp=(quotehttp://sirio:81/stream/7/<%=CodedURL%>quote).replace(/&/g, quote%26quote);
            temp=temp.replace(/+/g,quote%2Bquote);
            temp=temp.replace(/-/g,quote%3Aquote);
            mylist[j]=temp;
            document.write(temp +quote<br>quote);
            j++;
        </script>
<%                End If
            Next
   %>
  
  <script language="javascript">  
   flowplayer("player", "./flowplayer-3.1.1.swf",
   {playlist: mylist,
       plugins:  { 
           controls: {fullscreen: false, url: 'flowplayer.controls-3.1.1.swf',playlist: true, backgroundColor: '#aedaff',
               tooltips: {buttons: true}
           },
                    audio: {url: 'flowplayer.audio-3.1.0.swf'}
                }
            });
  </script>
 </div>
</body>
</html>

PaulOgilvie

Posts: 61

Registered:
Feb 15, 2009

» » » Single quote - again!

Posted: Jun 17, 2009

Reply to: » » Single quote - again!, from vashkenazy
So you only want to escape the filename's special characters.

Use:

var codedURL, temp;
codedURL= "And&plus+min-and'";
temp= escape(codedURL);
temp= temp.replace(/\+/g,'%2B');
temp= temp.replace(/-/g,'%3A'); 
temp= 'http://sirio:81/stream/7/' +temp;
Output:

http://sirio:81/stream/7/And%26plus%2Bmin%3Aand%27
Note that '+' is a special character in a regular expression, so you should write \+ to escape it. Use the escape function to escape all other funny characters:
"The escape function encodes special characters in the specified string and returns the new string. It encodes spaces, punctuation, and any other character that is not an ASCII alphanumeric character, with the exception of these characters:
* @ - _ + . /
"

vashkenazy

Posts: 6

Registered:
Jun 1, 2009

» » » » Single quote - again!

Posted: Jun 17, 2009

Reply to: » » » Single quote - again!, from PaulOgilvie
Thanks for reply Paul. I need more help. Actually I found that there's no need to escape the minus sign. The & symbol can be solved with the escape sequence, but both plus and single quote no. Try to pass an mp3 named '.mp3 or +.mp3 to the array in jscript, and you'll see flowplayer won't play it.

Thanks

Andrea

PaulOgilvie

Posts: 61

Registered:
Feb 15, 2009

» » » » » Single quote - again!

Posted: Jun 17, 2009

Reply to: » » » » Single quote - again!, from vashkenazy
'-' (minus sign) is %2D, not %3A (I reaallly need to check aallll the details!).

Bug confirmed and entered in issue list.

dammad

Posts: 26

Registered:
Oct 13, 2008

Single quote - any update?

Posted: Jul 19, 2009

Reply to: » » » » Single quote - again!, from vashkenazy
Did this get fixed? I'm facing the same problem.

DuyNgn

Posts: 11

Registered:
Jul 10, 2009

» Single quote - again!

Posted: Jul 22, 2009

Reply to: Single quote - again!, from vashkenazy
I'm also seeking a solution to this...

Play list does not like single quotes. The clips in my playlist contains a caption variable for each video... Currently, I cannot say something like, "Bob[single quote]s trip to Hawaii." (replace [single quote] with the apostrophe symbol) I'm guessing other characters are also showing the same issue.

mutton

Posts: 2

Registered:
May 14, 2009

» Single quote - again!

Posted: Sep 21, 2009

Reply to: Single quote - again!, from vashkenazy
I struggled with this issue for a while and my solution is to replace single quotes with %2527.

&#39; didn't work because of the ampersand.

%27 and u0027 didn't work because they seem to be interpreted as single quotes literally.

%2527 works, although %27 shows up in place of ' when the user saves the file.

For example,

playlist: [	{
	url: "Standard %26 Poor%2527s.flv",
	title: "Standard and Poor?s"
} ]
I still don't know how to get a single quote to show up in the title without breaking Flowplayer, so I've replaced it with a curly apostrophe for the user to see.

krabbe

Posts: 4

Registered:
Oct 20, 2009

» » Single quote - again!

Posted: Dec 2, 2009

Reply to: » Single quote - again!, from mutton
"' didn't work because of the ampersand."

I think in this case the ampersand isn't the problem, because in my playlist s.th. like "Bourrée" is correctly printed as "Bourrée" and doesn't break flowplayer.

In my case the problem-characters are single-quote and a single ampersand (&)
All the other characters I tested work fine...

differenthink

Posts: 22

Registered:
Mar 23, 2009

» » » Single quote - again!

Posted: Dec 15, 2009

Reply to: » » Single quote - again!, from krabbe
I tried everything posted in this thread but it s not working...
Is there any workaround ?

Thanks a lot !