cancel
Showing results for 
Search instead for 
Did you mean: 

Ampersand converted in HTML

Former Member
0 Kudos

Hi,

I have a BSP application where I am trying to output a company's name. Some of the companies have an "&" in the name. When the output to the screen rendered I get somthing like:

Sopranos & Co

rather then the expected ...

Sopranos & Co

I am using a <htmlb:inputField /> BSP Element for the output.

I tried setting the encode parameter to "FALSE", but made no difference.

Any assistance is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

instead of passing company name as

Sopranos & Co

pass it like below with escape character for &

<b>Sopranos &amp; Co</b>

Regards

Raja

Former Member
0 Kudos

Hi Raja,

thanks for your reply, I tried this, however passing in:

Sopranos &amp; Co

will just give me ...

Sopranos &amp;amp; Co

One thing I failed to mention, the Name of the company is stored in an XML file and retrieved from the XML file (I am dealing with a Web Request). Just now I went and had a look at the XML file in question, the name Sopranos &amp; Co appears there as well.

So I may have to rephrase the question. Is there any way of stopping the conversion of the & into &amp; when writing the data to an XML file.

Former Member
0 Kudos

I will close this issue and re-phrase it in a new post later on after I do some further investigation.

athavanraja
Active Contributor
0 Kudos

<i>Is there any way of stopping the conversion of the & into &amp; when writing the data to an XML file.</i>

XML file cannot have & and thats the reason its escaped using &amp; in XML file.

Regards

Raja

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>One thing I failed to mention, the Name of the company is stored in an XML file and retrieved from the XML file

It sounds like you are actually just reading the raw XML file and pulling out the data that you want. This can be dangerous as you have seen because many characters can be Encoded. It is best to use either CALL TRANSFORMATION or use the CL_IXML libraries to parse the XML. Encoded characters should automatically be translated for you in either of these cases.

Answers (0)