Consultor Eletrônico



Kbase 20861: How to translate non-HTML characters into their HTML equivalent.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

GOAL:

How to translate non-HTML characters into their HTML equivalent.

GOAL:

How to use html-encoding function to convert ASCII characters into HTML representation?

GOAL:

How to html-encode ASCII characters?

FIX:

The HTML-encoding function converts various ASCII characters in a string to their HTML representation. It returns the HTML-encoded string. This function is useful for constructing HTML output from SpeedScript program data.
HTML does not handle ASCII characters in the same way a text editor does. HTML requires an 'interpretation' of the ASCII characters, and consequently a translation of ASCII characters to HTML encoded 'characters'.

To avoid corrupting the encoding, do not execute the 'html-encoding' command more than once for a given string. The following lists special characters that are handled in this way and their equivalent HTML Encoding values:


Character     Description           Encoding

   ;         | Semicolon           |    %3B
             |                     |
   /         | Slash               |    %2F
             |                     |
   ?         | Question mark       |    %3F
             |                     |
   :         | Colon               |    %3A
             |                     |
   @         | At sign             |    %40
             |                     |
   =         | Equal sign          |    %3D
             |                     |
   &         | Ampersand           |    %26
             |                     |
   <         | Less-than sign      |    %3C
             |                     |
   >         | Greater-than sign   |    %3E
             |                     |
   "         | Double quote        |    %22
             |                     |
   #         | Hash symbol         |    %23
             |                     |
   %         | Percent             |    %25
             |                     |
   {         | Left curly brace    |    %7B
             |                     |
   }         | Right curly brace   |    %7D
             |                     |
   |         | Vertical bar        |    %7C
             |                     |
   \         | Backslash           |    %5C
             |                     |
   ^         | Caret               |    %5E
             |                     |
   ~         | Tilde               |    %7E
             |                     |
   [         | Left square bracket |    %5B
             |                     |
   ]         | Right square bracket|    %5D
             |                     |
   `         | Single quote        |    %60