Difference between revisions of "LlUnescapeURL"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 11: Line 11:
|constants
|constants
|examples=
|examples=
<lsl>default {
<lsl>
    state_entry() {
string str = "http://wiki.secondlife.com/wiki/LSL Portal";
          string str = "Any string, with anything in it, goes here!";
 
          llOwnerSay(llUnescapeURL(llEscapeURL(str)));
default
              //Tells the owner the string "str", because the Unescape and Escape are opposites of eachother.
{
    }
    state_entry()
}</lsl>
    {
        llOwnerSay("Plain string:\n\t" + str);
        // output: "http://wiki.secondlife.com/wiki/LSL Portal"
 
        llOwnerSay("Escaped string:\n\t" + llEscapeURL(str));
        // output: "http%3A%2F%2Fwiki%2Esecondlife%2Ecom%2Fwiki%2FLSL%20Portal"
 
        llOwnerSay("Escaped string unescaped again:\n\t" + llUnescapeURL( llEscapeURL(str) ));
        // output: "http://wiki.secondlife.com/wiki/LSL Portal"
 
        // because escaping and unescaping are exact opposite
        // and unescaping an escaped string returns the original
 
 
        //  For readability's sake it would make more sense to do:
        llOwnerSay("For readability's sake:\n\t" + "http://wiki.secondlife.com/wiki/" + llEscapeURL("LSL Portal"));
        // output: "http://wiki.secondlife.com/wiki/LSL%20Portal"
    }
}
</lsl>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llEscapeURL]]| Opposite of llUnescapeURL}}
|also_functions={{LSL DefineRow||[[llEscapeURL]]| Opposite of llUnescapeURL}}

Revision as of 02:43, 31 July 2012

Summary

Function: string llUnescapeURL( string url );

Returns a string that is an unescaped/unencoded version of url, replacing %20 with spaces etc.

• string url

Caveats

  • The hexadecimal encoded representation of UTF-8 byte encoding is the only supported means of access to non ASCII7 characters (Unicode characters).
    • Decoding of Unicode as %u#### is not supported.
  • The + character is not decoded as a space.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> string str = "http://wiki.secondlife.com/wiki/LSL Portal";

default {

   state_entry()
   {
       llOwnerSay("Plain string:\n\t" + str);
       // output: "http://wiki.secondlife.com/wiki/LSL Portal"
       llOwnerSay("Escaped string:\n\t" + llEscapeURL(str));
       // output: "http%3A%2F%2Fwiki%2Esecondlife%2Ecom%2Fwiki%2FLSL%20Portal"
       llOwnerSay("Escaped string unescaped again:\n\t" + llUnescapeURL( llEscapeURL(str) ));
       // output: "http://wiki.secondlife.com/wiki/LSL Portal"
       // because escaping and unescaping are exact opposite
       // and unescaping an escaped string returns the original


       //  For readability's sake it would make more sense to do:
       llOwnerSay("For readability's sake:\n\t" + "http://wiki.secondlife.com/wiki/" + llEscapeURL("LSL Portal"));
       // output: "http://wiki.secondlife.com/wiki/LSL%20Portal"
   }

}

</lsl>

See Also

Functions

•  llEscapeURL Opposite of llUnescapeURL

Articles

•  UTF-8
•  Base64
•  Combined Library: UnicodeIntegerToUTF8 Easily convert unicode character codes to string form.

Deep Notes

Search JIRA for related Issues

Signature

function string llUnescapeURL( string url );