Different results about urlencode(name of file) and detailed files

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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2250
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Different results about urlencode(name of file) and detailed files

Post by jmburnod » Sun Sep 09, 2018 4:52 pm

Hi All
I get a different results if i use name of file (by script or copy/paste from finder) or if I typed it directly in message box (OSX 10.13, LC indy 9.0)

Case name of file or copy/paste from finder
put urlencode("accordéon") = "accorde%3Fon"
Chartonum of "accordéon" = 97,99,99,111,114,100,63,111,110,46,112,110,103

Case name typed with keyboard in message box or from detailed files
put urlencode("accordéon") = "accord%8Eon"
Chartonum of "accordéon" = 97,99,99,111,114,100,142,111,110,46,112,110,103

It seems numtochar(63) = ? is used instead 142 = é

Does that what is expected ?

Best regards
Jean-Marc

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4663
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Different results about urlencode(name of file) and detailed files

Post by jacque » Mon Sep 10, 2018 10:31 pm

I get the same results. When text is imported from outside LC it is usually necessary to textDecode it first, but that isn't working either. I'd submit a bug report.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2250
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Different results about urlencode(name of file) and detailed files

Post by jmburnod » Tue Sep 11, 2018 8:30 am

Thanks again Jacqueline,
I’m afraid I will lost my last hair about file name with accented letter.
It seems that is the same for folder name but as far i know there is not a "detailed folder".
I will test this quick and dirty solution creating a folder "FoldersNameToFilesName" which contains files with folder name and use "detailed files" to get the correct urlecoded name. (not sure i'm clear here).
Best regards
Jean-Marc
P.S: bad day with Klondike (760) but I learn a lot about addiction process :D

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2250
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Different results about urlencode(name of file) and detailed files

Post by jmburnod » Tue Sep 11, 2018 1:17 pm

This seems work

Code: Select all

on getCorrectUrlNameFolder
   put "testUrlName" into tFolTest
   put specialfolderpath("documents" ) & "/" & tFolTest into tPathFolTest
   new folder tPathFolTest
   put "préintermédiaire" into tNameFol
   put tPathFolTest & "/" & tNameFol into tPathFol
   new folder tPathFol
   set the defaultfolder to tPathFolTest
   put tPathFolTest & "/" & tNameFol & ".txt" into tNameFile
   put "test" & the ticks into url("file:" & tNameFile) 
   set the defaultfolder to tPathFolTest
   put the files into tFiles
   filter tFiles without  ".DS_Store*"
   put the  detailed files into tDetFiles
   filter tDetFiles without  ".DS_Store*"
   put  urlEncode(char 1 to -5 of tFiles)  into tUrlNameFromTheFiles
   put char 1 to -5 of item 1 of tDetFiles into tUrlNameFromTheDetFiles
   put "UrlNameFromTheFiles = " && tUrlNameFromTheFiles & cr & "UrlNameFromTheDetFiles = "  &&  tUrlNameFromTheDetFiles
end getCorrectUrlNameFolder

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”