Difference between revisions of "Entity encode"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(Created page with '{{ #vardefine:name|entity_encode}}{{ #vardefine:return_type|string}}{{ #vardefine:aggregate|no}}{{ FunctionPage| name={{#var:name}}| function_category=Relay Browser Functions| …')
 
imported>Ulti
(expanding the "see also" to keep the url_encode, url_decode, entity_encode, entity_decode functions together as you'd expect)
 
(One intermediate revision by one other user not shown)
Line 6: Line 6:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Relay Browser Functions|
 
  
 
function1={{Function|
 
function1={{Function|
Line 35: Line 34:
 
</syntaxhighlight>}}|
 
</syntaxhighlight>}}|
  
see_also={{SeeAlso|form_field||entity_decode|write|writeln}}|
+
see_also={{SeeAlso|form_field||entity_decode|write|writeln|url_encode|url_decode}}|
 
more_info=See [[Relay_Override_Scripting#User_Interface_Script|User Interface Scripts]] for more information.|
 
more_info=See [[Relay_Override_Scripting#User_Interface_Script|User Interface Scripts]] for more information.|
 
}}
 
}}
 +
 +
[[Category:Relay Browser Functions]]

Latest revision as of 16:49, 14 October 2014

Function Syntax

string entity_encode(string value )

  • string value  to be encoded.

Used for converting text that might contain special characters such as ampersands and angle brackets so that it can safely be displayed in HTML.

Code Sample

Read the form fields in a UI script for use later.

void write_option(string label, string value, string current) {
   write("<option value='");
   write(value);
   write("'");
   if (value == current) {
      write(" selected");
   }
   write(">");
   write(entity_encode(label));
   writeln("</option>");
}

See Also

form_field() | entity_decode() | write() | writeln() | url_encode() | url_decode()

More Information

See User Interface Scripts for more information.