rejetto forum

Software => HTML & templates => HFS ~ HTTP File Server => RAWR-Designs => Topic started by: ladiko on November 30, 2007, 09:11:34 PM

Title: RAWR-Player and special characters
Post by: ladiko on November 30, 2007, 09:11:34 PM
Hello :-)

It seems like the RAWR-Player doesnt support special characters, for example ä ö ü ß é è, in folder or file names. is this known? is there an update planed?

thx in advance :-)
Title: Re: RAWR-Player and special characters
Post by: parade on November 30, 2007, 10:41:39 PM
http://www.rejetto.com/forum/index.php?topic=5200.0
Title: Re: RAWR-Player and special characters
Post by: day on November 30, 2007, 11:44:48 PM
edit: deleted to avoid misleading
Title: Re: RAWR-Player and special characters
Post by: TSG on December 01, 2007, 05:28:14 AM
Does that actually work dayletter? If it does I may look into using it.
Title: Re: RAWR-Player and special characters
Post by: day on December 01, 2007, 07:18:30 AM
edit: deleted to avoid misleading
Title: Re: RAWR-Player and special characters
Post by: parade on December 01, 2007, 08:15:30 AM
I think I found the solution...

try to change all "escape(" to "encodeURI("
and "unescape(" to "decodeURI("
I would like to try this.
Where do I have to change? In The RAWR-PreviewBox.js?
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 01, 2007, 11:02:55 AM
hmm there was a homepage for mobile devices where i needed encodeURIComponent(unescape(MyQuery)) to get it working. i try it later :-)

thank you for the information where to search. i post my results here.

Edit:
yeeeaaah!!! that's it!!!
go to RAWR-PreviewBox.js and change in line 87:
Code: [Select]
+escape(content)+to
Code: [Select]
+encodeURI(unescape(content))+
works with most european special characters in file and folder name. --> (http://img160.imageshack.us/img160/1741/specialcharactersoy0.th.jpg) (http://img160.imageshack.us/my.php?image=specialcharactersoy0.jpg)

for asian special characters i only get a question mark "?" in file listing so i maybe i need to install something to support it or it is a fault of HFS - should be tested by someone else :-)
Title: Re: RAWR-Player and special characters
Post by: day on December 01, 2007, 01:05:54 PM
ok..after some searching..

escape(charString)
Quote
The escape method returns a string value (in Unicode format) that contains the contents of charstring. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, a space is returned as "%20."

Characters with a value greater than 255 are stored using the %uxxxx format.

Note   The escape method should not be used to encode Uniform Resource Identifiers (URI). Use encodeURI and encodeURIComponent methods instead.

encodeURI(URIString)
Quote
The encodeURI method returns an encoded URI. If you pass the result to decodeURI, the original string is returned. The encodeURI method does not encode the following characters: ":", "/", ";", and "?". Use encodeURIComponent to encode these characters.

encodeURIComponent(encodedURIString)
Quote
The encodeURIComponent method returns an encoded URI. If you pass the result to decodeURIComponent, the original string is returned. Because the encodeURIComponent method encodes all characters, be careful if the string represents a path such as /folder1/folder2/default.html. The slash characters will be encoded and will not be valid if sent as a request to a web server. Use the encodeURI method if the string contains more than a single URI component.

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

I have done some experiments:

let say you want to convert the filename "測試" into "%E6%B8%AC%E8%A9%A6", which can then be used by the RAWR-player

content = %link-url%

case 1:

if the option "Encode non-ASCII characters" is switched on
%link-url% == "%E6%B8%AC%E8%A9%A6"

if you escape(content), it becomes "%25E6%25B8%25AC%25E8%25A9%25A6".
if you encodeURI(content),  it also becomes "%25E6%25B8%25AC%25E8%25A9%25A6".

in both case, "%" is converted into "%25",
for the mp3 player, it still works.
but for the divx player, seems like it doesn't?

case 2:

if the option "Encode non-ASCII characters" is swtiched off
%link-url% == "測試"

if you escape(content), it becomes "%u6E2C%u8A66", so it doesn't work.
but if you encodeURI(content),  it becomes "%E6%B8%AC%E8%A9%A6", so it works.

Since %link-name% always == "測試" no matter the option is on or off,
so, in my opinion, using %link-name% & encodeURI is better than using %link-url% & escape for Chinese characters.
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 01, 2007, 01:30:43 PM
and what about encodeURI(unescape(content)) ?
Title: Re: RAWR-Player and special characters
Post by: day on December 01, 2007, 02:20:10 PM
and what about encodeURI(unescape(content)) ?

i GUESS in your case encodeURI() is the same as escape() since the values of characters of your language are not greater 255, and you have the option switched on.

Therefore content = %item-link% is in encoded form, and so
encodeURI(unescape(content)) == content

maybe you could try

Quote
changing +encodeURI(unescape(content))+ to +content+

OR

Quote
switching off the option,
changing +encodeURI(unescape(content))+ back to +escape(content)+

to prove my theory.
Title: Re: RAWR-Player and special characters
Post by: TSG on December 01, 2007, 02:49:59 PM
Will have a play and include this fix in the next builds.

Sometimes ignorance is bliss. :) i wasn't even attempting to fix this :P thats why i like the forum so much. Thanks for your post :D

Before i implement... can i get someone to test this in IE6/7 Firefox and Opera. Nothing goes into the template until it works in all of those.
Title: Re: RAWR-Player and special characters
Post by: day on December 01, 2007, 03:32:49 PM
IE7 & Firefox works for me.

BTW, I think the effect of the option "Encode non-ASCII characters" is large and so must be considered.
I suggest that every template should be designed with that option swtiching on.
This is because with this you can use %encoded-folder% & %item-url% for encoded form,
and %folder% (%item-folder%) & %item-name% for original form.

Title: Re: RAWR-Player and special characters
Post by: ladiko on December 01, 2007, 03:53:48 PM
tested with firefox2 and ie7

+escape(content)+ & Encode non-ASCII-characters on

Firefox:divx-web-player ok, rawr-player not working
IE: rawr ok, divx not working

+escape(content)+ & Encode non-ASCII-characters off
Firefox:divx-web-player ok, rawr-player not working
IE: rawr ok, divx not working

############################

+content+ & Encode non-ASCII-characters on
Firefox: ok
IE rawr ok, divx not working

+content+ & Encode non-ASCII-characters off
Firefox: ok
IE: ok

############################

+encodeURI(unescape(content))+ & Encode non-ASCII-characters on
Firefox: ok
IE: rawr ok, divx not working

+encodeURI(unescape(content))+& Encode non-ASCII-characters off
Firefox: ok
IE: ok
Title: Re: RAWR-Player and special characters
Post by: day on December 01, 2007, 04:16:04 PM
+content+ & Encode non-ASCII-characters off
Firefox: ok
IE: ok

hmm...so your language does not even need to encode to have it working...
However, it is not that simple in my case...
I'm going make a quick fix and upload it here,
to see if it works for you or not..

edit:alright..uploaded..please try~
remember to switch on "Encode non-ASCII characters"
Title: Re: RAWR-Player and special characters
Post by: TSG on December 02, 2007, 12:20:04 PM
Thankyou for your testings. I will add this fix for next builds.
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 02, 2007, 01:25:38 PM
@dayletter: why do you change the template-file to submit the whole path to the rawr-previewbox.js as variable +content+ instead of only the filename as before? what is the effort?

so in rawr-previewbox you also changed this to get it working:
data=\"http://"+infoHost+infoFolder+escape(content)+"\" to data=\""+content+"\" and
value=\"http://"+infoHost+infoFolder+escape(content)+"\" to value=\""+content+"\" and
src=\"http://"+infoHost+infoFolder+escape(content)+"\" to src=\""+content+"\" in line 57 and 68. one effort is a little bit more code in the template, but 3times less code in js-file, but that couldnt be all?
Title: Re: RAWR-Player and special characters
Post by: day on December 02, 2007, 01:55:18 PM
@dayletter: why do you change the template-file to submit the whole path to the rawr-previewbox.js as variable +content+ instead of only the filename as before? what is the effort?

so in rawr-previewbox you also changed this to get it working:
data=\"http://"+infoHost+infoFolder+escape(content)+"\" to data=\""+content+"\" and
value=\"http://"+infoHost+infoFolder+escape(content)+"\" to value=\""+content+"\" and
src=\"http://"+infoHost+infoFolder+escape(content)+"\" to src=\""+content+"\" in line 57 and 68. one effort is a little bit more code in the template, but 3times less code in js-file, but that couldnt be all?

As you know, in the unmodified template,
the [file.mp3] section had already used the "whole path" form, while the other 3 sections had not.
Therefore, this is to make things a little clearer.

Besides, since infoFolder == %folder%, which can be "unencoded" (eg. having some chinese characters in it),
may cause the player to be not working.
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 02, 2007, 03:06:14 PM
ok i didnt know that this was the only exception, cause i only checked which part you changed. not that you change all urls linking to a chinese trojan :P your template is working for me, but i think if chinese is working, european special letters should too - so your language seems to be "the hardest" crunchpoint
Title: Re: RAWR-Player and special characters
Post by: day on December 03, 2007, 10:13:44 AM
wow i didn't know there was a %item-full-url% symbol before the new build came out.
now we can use %item-full-url% to replace http://%host%%encoded-folder%%item-url%.
Title: Re: RAWR-Player and special characters
Post by: Giant Eagle on December 03, 2007, 02:43:07 PM
Quote from: dayletter
As you know, in the unmodified template,
the [file.mp3] section had already used the "whole path" form, while the other 3 sections had not.
Therefore, this is to make things a little clearer.

The main reason why the full item url is fed to the rawr player, is to correctly enable the direct link creation and to fix some bugs with the search results.
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 09, 2007, 10:56:35 PM
is somebody able to play a song in flash player that has a & in it's file name? if yes, please tell me with which settings oO
Title: Re: RAWR-Player and special characters
Post by: TSG on December 10, 2007, 05:16:56 AM
If you do not url encode that might happen... cause & is a separator in flash vars. Same as url variables. ?var&var&var
Title: Re: RAWR-Player and special characters
Post by: ladiko on December 10, 2007, 07:14:51 PM
"Encode non-ASCII characters" is enabled, but & is an ascii character
hmm ... so i need escape() or what?
Title: Re: RAWR-Player and special characters
Post by: rejetto on December 11, 2007, 01:31:56 AM
well, you are right, & should be escaped only if it's after "?"
also other characters should not be encoded before "?", i will fix this in next beta
Title: Re: RAWR-Player and special characters
Post by: felldownawell on December 27, 2007, 05:12:09 AM
is somebody able to play a song in flash player that has a & in it's file name? if yes, please tell me with which settings oO

has this been resolved?  what adjustments do i need to make?  thanks.
Title: Re: RAWR-Player and special characters
Post by: parade on January 10, 2008, 10:48:14 AM
Could anybody please explain to me the changes to make in the TOG? (Rawr-Player and TPL)
As I have made some changes in the ToG for myself it would be better for to know the changes to make than get a complete new TPL.

Thank you very much.
parade
Title: Re: RAWR-Player and special characters
Post by: TSG on January 10, 2008, 11:35:31 AM
Can you test the Beta of our new template for me? That has a redone preview box method.

(http://www.rawr-designs.com/?downloadbutton=15) (http://www.rawr-designs.com/?download=15)

This is the code i intend to use in the next ToG and Terayon.
Title: Re: RAWR-Player and special characters
Post by: parade on January 10, 2008, 06:31:19 PM
Can you test the Beta of our new template for me? That has a redone preview box method.

[This is the code i intend to use in the next ToG and Terayon.
As you know I tested it and it works with german characters but not with & and +.

But as I will still use my modified ToG for some time, I am interested to know, where I have to make in changes in ToG, to make it work there too.
Title: Re: RAWR-Player and special characters
Post by: TSG on January 10, 2008, 06:36:29 PM
It's complicated. I really can't explain it. Wait for the next release of the ToG. It will take me some time to overhaul it anyway.

Read my reply in the rawr-template thread.