Skip to main content
Known Participant
September 11, 2014
Answered

How to set a variable to a string with special characters?

I want to set a variable to

<cfset inputstring = "<img src="../../../server/win/form/stamp/string_1" />"/>

but i keep getting error:

Invalid CFML construct found on line 184 at column 32.

ColdFusion was looking at the following text:

.

I have try it different ways , what i'm i doing wrong?

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    September 11, 2014

    You have to either escape the inner quotes or mix single and double quotes.  Try:

    <cfset inputstring = "<img src=""../../../server/win/form/stamp/string_1"" />"/>


    or

    <cfset inputstring = '<img src="../../../server/win/form/stamp/string_1" />'/>


    Oh, and the trailing forward slashes aren't necessary in the <cfset> tag.

    -Carl V.

    1 reply

    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    September 11, 2014

    You have to either escape the inner quotes or mix single and double quotes.  Try:

    <cfset inputstring = "<img src=""../../../server/win/form/stamp/string_1"" />"/>


    or

    <cfset inputstring = '<img src="../../../server/win/form/stamp/string_1" />'/>


    Oh, and the trailing forward slashes aren't necessary in the <cfset> tag.

    -Carl V.

    Translate