Difference between revisions of "LlEscapeURL"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 4: Line 4:
|func_footnote=To clarify, numbers and ASCII7 alphabetical characters are NOT escaped. If a character requires more then one byte in UTF-8 byte form then it returns multiple %xx sequences chained together.
|func_footnote=To clarify, numbers and ASCII7 alphabetical characters are NOT escaped. If a character requires more then one byte in UTF-8 byte form then it returns multiple %xx sequences chained together.
|func_desc
|func_desc
|return_text=that is the escaped/encoded version of '''url''', replacing spaces with %20 etc. The function will escape any character not in [a-zA-Z0-9] to %xx where xx is the hexadecimal value of the character in UTF-8 byte form.
|return_text=that is the escaped/encoded version of '''url''', replacing spaces with ''%20'' etc. The function will escape any character not in {a-z, A-Z, 0-9} to ''%xx'' where "xx" is the hexadecimal value of the character in UTF-8 byte form.
|spec
|spec
|other_languages={{LSL OL|PHP|[http://php.net/manual/en/function.rawurlencode.php rawurlencode]}}
|other_languages={{LSL OL|PHP|[http://php.net/manual/en/function.rawurlencode.php rawurlencode]}}
|caveats=* The function is not appropriate for escaping a URL all at once because the ':' after the protocol and all of the '/' characters delimiting the various parts will be escaped. Instead, build the URL in parts, escaping parts of the path and query string arguments as needed.
|caveats=* The function is not appropriate for escaping a URL all at once because the ':' after the protocol and all of the '/' characters delimiting the various parts to be escaped. Instead, build the URL in parts; escaping parts of the path and query string arguments as needed.
|constants
|constants
|examples=<lsl>
|examples=<lsl>
//  provides a clickable link to the LSL Portal by escaping the space in the title
//  Provides a clickable link to the LSL Portal by escaping the space in the title
//  "LSL Portal" here becomes "LSL%20Portal"
//  "LSL Portal" here becomes "LSL%20Portal"


Line 31: Line 31:
|notes
|notes
|permission
|permission
|history=
|history=*Prior to SL versions 1.19.1.81992, this function was limited to returning a maximum of 254 characters. {{Jira|SVC-470}}
*Prior to SL versions 1.19.1.81992, this function was limited to returning a maximum of 254 characters. {{Jira|SVC-470}}
|cat1=Encoding
|cat1=Encoding
|cat2=String
|cat2=String

Revision as of 20:25, 7 December 2013

Summary

Function: string llEscapeURL( string url );

Returns a string that is the escaped/encoded version of url, replacing spaces with %20 etc. The function will escape any character not in {a-z, A-Z, 0-9} to %xx where "xx" is the hexadecimal value of the character in UTF-8 byte form.

• string url

To clarify, numbers and ASCII7 alphabetical characters are NOT escaped. If a character requires more then one byte in UTF-8 byte form then it returns multiple %xx sequences chained together.

This function is similar to functions (e.g. rawurlencode) found in many other languages: 
PHP
rawurlencode

Caveats

  • The function is not appropriate for escaping a URL all at once because the ':' after the protocol and all of the '/' characters delimiting the various parts to be escaped. Instead, build the URL in parts; escaping parts of the path and query string arguments as needed.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> // Provides a clickable link to the LSL Portal by escaping the space in the title // "LSL Portal" here becomes "LSL%20Portal"

string title = "LSL Portal";

default {

   state_entry()
   {
       llOwnerSay("http://wiki.secondlife.com/wiki/" + llEscapeURL(title));
   }

}

</lsl>

See Also

Functions

• llUnescapeURL

Articles

• UTF-8
• Base64

Deep Notes

History

  • Prior to SL versions 1.19.1.81992, this function was limited to returning a maximum of 254 characters. SVC-470

Search JIRA for related Issues

Signature

function string llEscapeURL( string url );