Chapter 4-8: Runtime Subroutine's and Predefined Processes
.CONVERT HTML TO TEXT
.CONVERT HTMLTO TEXT
This subroutine converts a HTML field to plain APPX text. Release 5.5.x and higher.
Usage:
PASS <text> FIELD SHARE? Y
PASS <html> FIELD SHARE? N
GOSUB --- .CONVERT HTML TO TEXT
* check for errors
IF --- .CONVERT HTML TO TEXT NE
Description:
This subroutine converts a field containing HTML tags and encodings into plain APPX text. All parameters are required, if any are missing the subroutine will CANCEL.
<text> returns the converted <html> (Required). This must be PASSed with Share "Y" to return the value.
<html> is the HTML data you want converted (Required).
This routine will first convert any <br> tags to chr(182), strip all remaining HTML tags, then convert any HTML entites into their ISO-8859-15 single byte equivalents, ie, <p> becomes the paragraph symbol (chr(182)), etc. Entities that can't be converted will be changed to a space.
If <text> is too small to contain the converted text, --- .CONVERT HTML TO TEXT will contain 'Data was truncated'.