Difference between revisions of "Entity encode"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
m
imported>Ulti
(expanding the "see also" to keep the url_encode, url_decode, entity_encode, entity_decode functions together as you'd expect)
 
Line 34: 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]]
 
[[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.