file name is urlEncoded ?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: file name is urlEncoded ?

Post by Mark » Sun Jan 06, 2013 4:33 pm

I'm not asking about the files but about the file paths.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: file name is urlEncoded ?

Post by jacque » Sun Jan 06, 2013 8:41 pm

Mark, yes, you're right that my function will not work for everything, but yours won't either. There isn't any good way to know if the special characters are intended to be part of the name or not. I'm not clear why it matters where the files come from; if they are saved to disk with special characters the script needs to deal with them.

Your method has the same issues as mine. If the file name really does contain special characters then its existence will be reported as true and your method will return false (not encoded). I'm not sure the problem is completely solveable. Checking a list of specific characters won't work either for the same reason, there's no way to know if the character was intended or part of an encoded name.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: file name is urlEncoded ?

Post by jacque » Sun Jan 06, 2013 9:08 pm

jmburnod, thinking about this more, maybe the real question is "why do you need to know?" If you are just working with files, then their name on disk is their "real" file name. Using that file name allows access to the file (read/write) and any lists the stack needs to display will be accurate representations of what is on disk. If we know why decoding is necessary, maybe there is a different way to solve it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: file name is urlEncoded ?

Post by jmburnod » Mon Jan 07, 2013 12:29 am

Hi,
Jacques,
why do you need to know ?
Users should be able to add files that come from a server or from his owner desktop or device machine and it is possible to have urlencoded files or not.

Mark
Where come the files from ?
The files come from my iPad or zip archive in the alternatic server or the user's computer
There are urlencoded because that is a way that I found to keep the diacritical chars of a filename in a .zip archive.

Kind regards

Jean-Marc
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: file name is urlEncoded ?

Post by jacque » Mon Jan 07, 2013 3:45 am

jmburnod wrote: Users should be able to add files that come from a server or from his owner desktop or device machine and it is possible to have urlencoded files or not.
Hm. Would it be safe to assume that you should decode files from a remote server or device, but not from the local machine?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: file name is urlEncoded ?

Post by jmburnod » Mon Jan 07, 2013 11:22 am

Hi Jacque,

Code: Select all

Would it be safe to assume that you should decode files from a remote server or device, but not from the local machine?
Yes, if there is no solution to recognize a name of file encoded but it pushes away the problem farther: a user could have a file encoded on his hard disk
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: file name is urlEncoded ?

Post by jacque » Mon Jan 07, 2013 7:04 pm

jmburnod wrote: Yes, if there is no solution to recognize a name of file encoded but it pushes away the problem farther: a user could have a file encoded on his hard disk
True, but in that case the encoded name really is the name of the file. It will look the same in the OS (Finder or Explorer.)

It's an interesting question. Are you on the mailing list? Some of the people there may have ideas. If you aren't, I can ask for you and let you know.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: file name is urlEncoded ?

Post by jmburnod » Mon Jan 07, 2013 7:15 pm

Jacque wrote
Are you on the mailing list ?
No. Which is the procedure to appear to it ?
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: file name is urlEncoded ?

Post by jmburnod » Sat Jan 12, 2013 11:27 am

Hi All,
I don't know what is the best place for this post (This one or a new topic in the IOS)
It concern the same mistake but on IOS

I remain a little confused with file name urlencoded

If a file name with space is urlEncoded on IOS
urlEncode("Céline est arrivée.txt") = "C%258Eline+est+arriv%8Ee.txt"
and the file name = "C%258Eline+est+arriv%8Ee.txt"

if not

"Céline est partie.txt" = "C%258Eline est arriv%8Ee.txt"
The diacritical char is urlEncoded but not the space char

Fortunately urlDecode("C%258Eline est arriv%8Ee.txt") = "Céline est arrivée.txt"

Best regards
Jean-Marc
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: file name is urlEncoded ?

Post by jacque » Sat Jan 12, 2013 8:31 pm

jmburnod wrote:
Jacque wrote
Are you on the mailing list ?
No. Which is the procedure to appear to it ?
Sorry, I just saw this. For some reason, "read new posts" didn't show me this last week. You can sign up for the mailing list here:
http://lists.runrev.com/mailman/listinfo/use-livecode/

I have had issues with iOS urlencoding too. Maybe someone on the mailing list knows more about it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: file name is urlEncoded ?

Post by jmburnod » Sun Jan 13, 2013 10:53 am

Jacque said: You can sign up for the mailing list here:
Thank Jacque. I'll do that
https://alternatic.ch

Post Reply