urlDecode specials chars
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 10
- Joined: Mon Aug 26, 2013 6:49 pm
urlDecode specials chars
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
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
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
https://alternatic.ch
-
- Posts: 10
- Joined: Mon Aug 26, 2013 6:49 pm
Re: urlDecode specials chars
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.
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
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
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
https://alternatic.ch
-
- Posts: 10
- Joined: Mon Aug 26, 2013 6:49 pm
Re: urlDecode specials chars
Thanks Jean-Marc for your contribution
I have understood an origine of the problem illustrated there:
I have understood an origine of the problem illustrated there:
Re: urlDecode specials chars
OK, but did you solve it ?I have understood an origine of the problem illustrated there:
Best regards
Jean-Marc
https://alternatic.ch