Page 1 of 1

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

Posted: Sun Sep 09, 2018 4:52 pm
by jmburnod
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

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

Posted: Mon Sep 10, 2018 10:31 pm
by jacque
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.

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

Posted: Tue Sep 11, 2018 8:30 am
by jmburnod
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

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

Posted: Tue Sep 11, 2018 1:17 pm
by jmburnod
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