Show TOC

writeEnc FunctionLocate this document in the navigation structure

Use

Purpose

Writes output to the HTML page, converting all non-alphanumeric characters to hexadecimal.

Syntax

writeEnc ( <expression> {, <expression>})

Description

The writeENC function works like write, except that the output is encoded according to URL requirements.

This function lets you construct URLs correctly from fields that contain spaces and special characters. All non-alphanumeric characters (such as spaces and special characters) are converted to their hexadecimal equivalents.

Example

The following example illustrates the difference between write and writeEnc.

Using write, you could write:

        
<a href="http://pn0208/scripts/any.dll?matbez=`write(matbez[j])`&quantity=1">
         

The least favorable expansion of this code is:

        
<a href="http://pn0208/scripts/any.dll?matbez=Large Chairs&quantity=1">
         

Spaces like the one in Large Chairs are not permitted in URLs.

However, using writeEnc, you could write:

        
<a href="http://pn0208/scripts/any.dll?matbez=`writeEnc(matbez[j])`&quantity=1">
         

The following is completely correct, because the strings Large and Chairs have been separated by the code for a space:

        
<a href="http://pn0208/scripts/any.dll?matbez=Large%20Chairs&quantity=1">