Format Accented Characters for URL?

Scott Rossi scott at tactilemedia.com
Tue Sep 25 23:46:41 EDT 2012


Darn -- maybe I spoke too soon.

It seems that uniEncoding/Decoding works fine on the desktop, but perhaps
doesn't work when run from an irev file?

After getting empty values returned from the server, I tried these simple
tests:
put uniDecode(uniEncode("ABC"),"utf8");exit to top
put uniEncode("ABC");exit to top


In both cases, I get an empty page.

Is there a trick to make uniEncoding work in an irev file?  I found one
thread about uploading text files in the proper format, but I'm not using
any uploaded files, and even the case above with the simple string seems
to be failing.

Thanks for any enlightenment.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design




On 9/25/12 7:54 PM, I wrote:

>Thanks so much Dave -- that seems to work.  I discovered I was also
>encoding a parameter along with the URL which was part of the problem,
>but 
>your routine solved the character issue.
>
>Thanks & Regards,
>
>Scott Rossi
>Creative Director
>Tactile Media, UX Design
>
>
>
>
>On 9/25/12 4:26 PM, "Dave Cragg" <dave.cragg at lacscentre.co.uk> wrote:
>
>>
>>On 25 Sep 2012, at 21:29, Scott Rossi <scott at tactilemedia.com> wrote:
>>
>>> Hi List:
>>> 
>>> Wondering if someone has a suggestion for URL character formatting in
>>>LCŠ
>>> 
>>> I'm trying to format a URL string to submit to Google Maps.  The
>>>string 
>>>is a
>>> street address that needs to be delimited using "+".  The complication
>>> arises when an address contains an accented character like ñ (n +
>>>tilde).
>>> If I change the ñ to a roman n, the address is processed, but I
>>>thought 
>>>I
>>> could use something like urlEncode to handle problem characters.
>>
>>Hi Scott
>>
>>I think the + char is an encoded space. That's what LC outputs instead
>>of 
>>the %20 alternative.
>>
>>I'm guessing that strings with characaters such as ñ (n + tilde) need to
>>be in UTF8 format before using url encode.
>>
>>Example:
>>
>>Here's a slightly exotic version of a well-known address:
>>
>>25a Thistlé Street SW Lañe, Edinburgh
>>
>>If we put that into field 1, then run the following:
>>
>>put uniDecode(uniEncode(field 1), "UTF8") into tA
>>put urlencode(tA)
>>
>>it gives: 25a+Thistl%C3%A9+Street+SW+La%C3%B1e%2C+Edinburgh
>>
>>If we try this url in a browser:
>>
>>maps.google.com/maps?q=25a+Thistl%C3%A9+Street+SW+La%C3%B1e%2C+Edinburgh
>>
>>Apologies if any of the above gets rearranged in the mail.
>>
>>Dave
>>_______________________________________________
>>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