Functions

ygnEncode

Supported By

Syntax

the ygnEncode of text

the ygnEncode of ( text [, level [, collapseBackslashes]] )

ygnEncode ( text [, level [, collapseBackslashes]] )

Text yields a string. Level yields an integer. CollapseBackslashes yields a boolean.

Description

The ygnEncode function encodes backslashes, apostrophes, quotation marks, and equals signs in the specified string as the sequences =B=, =A=, =Q=, and =E=, respectively, and returns the encoded string.

If level is zero or greater, the ygnEncode function also encodes percent signs, underscores, question marks, and asterisks as the sequences =P=, =U=, =H=, and =S=, respectively, effectively masking off commonly-used and SQL-specific wildcard characters.

If level is one or greater, the ygnEncode function also encodes less-than signs, greater-than signs, and ampersands as the sequences =L=, =G=, and =M=, respectively, effectively masking off XML tag characters.

If level is two or greater, the ygnEncode function also encodes the following symbols thusly:

exclamation point =X=
pound sign =O= (mnemonic: "octothorpe")
dollar sign =D=
plus sign =N=
slash =F= (mnemonic: "fraction")
colon =C=
semicolon =K=
opening bracket =I=
closing bracket =J=
caret =R= (mnemonic: "raise")
grave accent =W= (mnemonic: "which," as in `which gcc` hello.c)
opening brace =Y=
closing brace =Z=
vertical bar =V=
tilde =T=

Finally, if level is three or greater, the ygnEncode function also encodes control characters and non-ASCII characters as the sequence =Xhex=, where hex is a hexadecimal integer using capital letters representing the Unicode code point of the character.

If collapseBackslashes is true, any backslashes immediately preceding a backslash, apostrophe, or quotation mark are ignored.

See Also

ygnDecode, urlEncode, urlDecode, htmlEncode, htmlDecode