Converts a value to a string.


A string.


Conversion functionsString functions

Function syntax

ToString(value[, encoding])

See also

ToBase64ToBinaryCharsetEncodeUsing XML and WDDX in the Developing ColdFusion Applications


ColdFusion MX:

  • Changed Unicode support: ColdFusion supports the Java UCS-2 representation of Unicode character values 0-65535. (ColdFusion 5 and earlier releases supported ASCII values 1-255.)
  • Added the encoding parameter.
  • Added ability to convert an XML document object to a string.





Value to convert to a string; can be a simple value such as an integer, a binary object, or an XML document object.


The character encoding (character set) of the string. Optional for binary data, Generates an error if used for a simple value or XML document object.The following list includes commonly used values:

  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16
    For more information on character encoding, see: The default value is the encoding of the page on which the function is called. See cfcontent.


This function can convert simple values and binary values that do not contain Byte zero. If this function cannot convert a value, it throws an exception. This function can also convert an XML document object to a string XML representation.Adobe recommends that you use the CharsetEncode function to convert binary data to a string.


    myString="Hello ColdFusion, how are you?"
    base64Value = toBase64(myString)
    binaryValue = toBinary(base64Value)
    stringValue = toString(binaryValue);

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy