Generates a URL-encoded string. For example, it replaces spaces
with %20, and non-alphanumeric characters with equivalent
hexadecimal escape sequences. Passes arbitrary strings within a

urlEncodedFormat(String [, charset]) → returns string

Discouraged: The continued use of this function is discouraged. It is recommended that you use EncodeForURL for all new applications.

Argument Reference

String string

A string or a variable that contains one

charset string

The character encoding in which the string is encoded.
  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

Sample code invoking the urlEncodedFormat function

It returns url encoded string.

writeOutput(URLEncodedFormat('This is a string with special character.'));

Expected Result: This%20is%20string%20with%20special%20character%2E

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub