AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
htmlEncode (String str [, String extra]) yoix.string
 
Translates each character in str into a character or character encoding suitable for HTML. In essence, all printable ASCII characters and the newline and carriage return characters pass through unchanged with the exception of the less than, greater than, ampersand and double quote characters. All characters that are not passed through unchanged are converted into the form &#N;, where N is the decimal value of the character. The optional extra argument, if it is supplied and not NULL, is a collection of additional characters that will be automatically encoded in this format.
 
 Example:   The program,
import yoix.string.*;

String text = "<B>Hello, World.</B>";

stdout.nextline = text;
stdout.nextline = htmlEncode(text);
stdout.nextline = htmlDecode(htmlEncode(text));
stdout.nextline = htmlEncode(text, "ro");
stdout.nextline = htmlDecode(htmlEncode(text, "ro"));
prints
<B>Hello, World.</B>
&#60;B&#62;Hello, World.&#60;/B&#62;
<B>Hello, World.</B>
&#60;B&#62;Hell&#111;, W&#111;&#114;ld.&#60;/B&#62;
<B>Hello, World.</B>
on standard output.
 
 Return:   String
 
 See Also:   htmlDecode

 

Yoix is a registered trademark of AT&T Inc.