& returning &

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Fromm603
Posts: 31
Joined: Fri Apr 26, 2019 10:51 pm

& returning &

Post by Fromm603 »

I have a field in a LANSA defined file that is a CLOB. When I do an SQL in an SQLRPGLE program to retrieve the data the character '&' returns '&'.
How do I stop this? What causes this? Are there other characters this will happen to?
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: & returning &

Post by MarkD »

Is the CLOB data formatted as HTML, XMLor just plain text ?
Fromm603
Posts: 31
Joined: Fri Apr 26, 2019 10:51 pm

Re: & returning &

Post by Fromm603 »

HTML.
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: & returning &

Post by MarkD »

That's why the ampersand ( & ) is &

That's also why, for example, less than ( < ) and greater than ( > ) characters would be stored as &lt; and &gt;

See https://www.htmlhelp.com/reference/html ... ecial.html for an example of some of the most common characters.

I don't think you can stop this because it's correct HTML.
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: & returning &amp;

Post by MarkD »

To understand why this happens try this incorrect HTML fragment:

<div> I like use a lot of <div> tags in my HTML pages </div>

It needs to be coded as

<div> I like use a lot of &lt;div&gt; tags in my HTML pages </div>

to work.
Post Reply