Skip to main content
Known Participant
September 9, 2010
Answered

append the string "&lang=fr"

  • September 9, 2010
  • 1 reply
  • 372 views

I like to append the string "&lang=fr" to the variable path.

<cfset newpath = path & "&lang=fr">

<cfoutput>#newpath#</cfoutput>

The output is

index.cfm<=fr

but not the desired output

index.cfm&lang=fr

Please help.
This topic has been closed for replies.
Correct answer ilssac

There is a very good chance that the output IS "index.cfm&lang=fr", but your browser is choosing to not display it that way.

View the page source to confirm this.

Short strings like that that start with an ampersand symbol (&) are often interpeted as a character encoding by browsers.

You can also force the browser to display the string in the desired manner with the htmlEditFormat() or htmlCodeFormat() functions.  Which, somewhat interestingly, will encode the special characters such as the ampersand.

I.E.

<cfoutput>#htmlEditFormat(newPath)#</cfoutput>

1 reply

ilssac
ilssacCorrect answer
Inspiring
September 9, 2010

There is a very good chance that the output IS "index.cfm&lang=fr", but your browser is choosing to not display it that way.

View the page source to confirm this.

Short strings like that that start with an ampersand symbol (&) are often interpeted as a character encoding by browsers.

You can also force the browser to display the string in the desired manner with the htmlEditFormat() or htmlCodeFormat() functions.  Which, somewhat interestingly, will encode the special characters such as the ampersand.

I.E.

<cfoutput>#htmlEditFormat(newPath)#</cfoutput>