Page 1 of 1

urlDecode specials chars

Posted: Fri Jul 31, 2015 10:56 am
by Jean-marc Radigois
to read the content of a folder, I use "put UrlDecode(the detailed files)". One of the files is named "délai.pdf". With LiveCode 5.5.5, I obtain "délai.pdf"; with LiveCode 7.0.6 I obtain ""de?lai.pdf" (I use Mac OS X 10.10.4). Wath is wrong ? any can help ? thanks

Re: urlDecode specials chars

Posted: Fri Jul 31, 2015 12:15 pm
by jmburnod
Hi Jean-Marc
I regulary meet strange results with file name with accented chars.
I got the same result with your example
If read a folder content is the goal, I wonder if you need detailed files.
Why not use just "the files" ?
I suppose there is a unicode way and I am sure one livecoder coming soon with a unicode way
Best regards
Jean-Marc

Re: urlDecode specials chars

Posted: Fri Jul 31, 2015 1:45 pm
by Jean-marc Radigois
thanks Jean-Marc,
I use detailed files because I need to known the size of the file and its date creation.
Because of your response, I have reported a bug (I don't know if this bug is repaired since Livecode 7 that I use).

My bug's report:
if a file's name contents an accented char as "é" the detailed files reports the name of this char as "e%3F" and not "%8E". So when you use urlDecode of this char, you do not obtains "é" but "e?".
The LiveCode 5.5.5 gives a good value, but not LiveCode 7.0.4
Notice that the result of "the files" (and not the detailed files) gives a good answer.

Re: urlDecode specials chars

Posted: Fri Jul 31, 2015 2:26 pm
by jmburnod
I worked for a function GetSizeOneFile and it works for me.
The trick seems encode the name of the file and search it in detailed files
I hope that is the case for you

Code: Select all

on mouseUp
   answer file "Open file"
   if it = empty then exit mouseup
   put it into tPathFile
   set the itemdel to "/"
   put item 1 to -2 of tPathFile into tPathFol
   put item -1 of tPathFile into tNameFile
   set the itemdel to ","
   put urlencode(tNameFile) into tNameFileUrl
   set the defaultfolder to tPathFol
   put the detailed files into tDetFilesS
   put GetSizeOneFile(tNameFileUrl,tDetFilesS)
end mouseUp

function GetSizeOneFile pNameFi,pDetFilesS
   put empty into rGetSizeOneFile
   put lineoffset(pNameFi,pDetFilesS) into tFoundLi
   get line tFoundLi of pDetFilesS
   put item 2 of it into tSize1
   put item 3 of it into tSize2 
   put tSize1 & "," & tSize2 into rGetSizeOneFile
   return rGetSizeOneFile
end GetSizeOneFile

Re: urlDecode specials chars

Posted: Sat Aug 01, 2015 8:33 am
by Jean-marc Radigois
Thanks Jean-Marc for your contribution
I have understood an origine of the problem illustrated there:
Photo.png

Re: urlDecode specials chars

Posted: Sat Aug 08, 2015 5:29 pm
by jmburnod
I have understood an origine of the problem illustrated there:
OK, but did you solve it ?
Best regards
Jean-Marc