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>Bale
m
Line 6: Line 6:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Relay Browser Functions|
 
  
 
function1={{Function|
 
function1={{Function|
Line 38: Line 37:
 
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]]

Revision as of 05:26, 22 May 2010

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()

More Information

See User Interface Scripts for more information.