Setting url of browser widget, incompatible characters

Tore Nilsen tore.nilsen at me.com
Wed Mar 23 08:30:19 EDT 2016


It did not work. URLEncode also encodes “/“  to %2 and spaces to + as you can see:
file://%2FUsers%2Ftorenilsen%2FDocuments%2FMultimedieLab%2FMusikk%2F01+My+My%2C+Hey+Hey+%28Out+of+the+Blue%29.m4p



Tore


> 23. mar. 2016 kl. 13.24 skrev Tore Nilsen <tore.nilsen at me.com>:
> 
> I’ll try that. Thank you.
> 
> Tore
> 
>> 23. mar. 2016 kl. 13.22 skrev Peter TB Brett <peter.brett at livecode.com>:
>> 
>> On 23/03/2016 12:11, Tore Nilsen wrote:
>>> This would work unless the file name contained space characters. Changing the script to replace space characters with %20 would rectify this problem.
>>> 
>>> on mouseUp
>>> 
>>> answer file "Choose file"
>>> 
>>> put "file://"& it into tPath
>>> 
>>> repeat with i = 1 to the number of chars of tPath
>>> 
>>> if char i of tPath is space then
>>> 
>>> put "%20" into char i of tPath
>>> 
>>> end if
>>> 
>>> end repeat
>>> 
>>> put tPath into field "url"
>>> 
>>> set url of widget "browser" to tPath
>>> 
>>> end mouseUp
>> 
>> Hi Tore,
>> 
>> You should use URLEncode().  For example:
>> 
>>   on mouseUp
>>      answer file "Choose file"
>>      put "file://" & URLEncode(it) into tUrl
>>      put tUrl into field "url"
>>      set url of widget "browser" to tUrl
>>   end mouseUp
>> 
>> I'm just in the process of updating the documentation for the browser widget to make this clearer.
>> 
>>                                            Peter
>> 
>> -- 
>> Dr Peter Brett <peter.brett at livecode.com>
>> LiveCode Open Source Team
>> 
>> LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list