Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Visualformat clean bug?
mike_s
Has anyone else encountered the situation where visualformat interprets the string &lang as an entity reference and attempts to resolve it into the character string represented by ⟨?
Our user needs to enter, via the HTML mode of a visualformat field, a URL which contains the string &lang=.
Is this a visualformat bug?
Is there a way of configuring Visualformat to ignore this value? I've tried using the preservechars attrib of the clean element of the visualformat config but it fails to load the config file if you enter an attribute of '&lang' (understandably) and an attribute value of 'lang' doesn't seem to have any effect.
Find more posts tagged with
Comments
ela
Hi Mike,
Did you try preserving the & in the visualformatconfig file? Then it should appear as & in the form.
Regards,
Eldbjoerg
mike_s
Hi Eldbjoerg,
Thanks for the post but I'm not sure what you mean. The problem isn't so much with VF converting the ampersand but with VF thinking &lang is an entity reference when it isn't. If I type in '&lang=', VF makes no attempt to convert it, but if I type in '&lang=' it converts it.
DougD
In HTML, the & char is used to prefix an entity name, like ⟨ or character reference, like 〈.
When the editor sees &lang it interprets it as ⟨, which is the Unicode character U9001.
To use & in HTML, it must be HTML encoded as its entity name, that is, &
So when using it in a URL, the text should be &lang= rather than &lang=.
See HTML 2.0 footnote 26, which reads:
"The URI from a query form submission can be used in a normal anchor style hyperlink. Unfortunately, the use of the "&" character to separate form fields interacts with its use in SGML attribute values as an entity reference delimiter. For example, the URI
http://host/?x=1&y=2
must be written <a href="
http://host/?x=1&y=2
" or <a href="
http://host/?x=1&y=2
">. HTTP server implementors, and in particular, CGI implementors are encouraged to support the use of ";" in place of "&" to save users the trouble of escaping "&" characters this way."
href="
http://www.w3.org/MarkUp/html-spec/html-spec_foot.html#FOOT26"
ela
Sorry if I was confusing you, but I'm obviously not totally sure what you need to do.
We use lots of links like this: "
http://....&id=100000&lang=de
", but don't experience any problems. Is this the same as you want to do?
If I understand you correctly, you get the correct result when typing &lang=, which means that you will get the same result if you add & in the <preservechars/> tag in the visualformatconfig file. Then you should be able to type &lang= in your datacapture form, without getting any errors.
This is from my visualformatconfig.xml file:
<clean charencode="utf-8" cr="cr" lf="lf" prompt="false" preferfonttag="false" reducetags="true">
<preservechars value="&<>"/>
If it's still not clearer or not what you need, please provide some more details; text/link example + attach your visualformatconfig file
Regards,
Eldbjoerg
mike_s
I understand this, however as &lang is not an entity reference (whereas ⟨ is) due to the missing semi-colon at the end, VF should not be treating it as such, surely. All other parameters if the URI are left untouched and they are written in the same way. The following URL:
http://www.blahblah.com/a_page.asp?arg1=value1&lang=en&theme=normal
converts to this:
http://www.blahblah.com/a_page.asp?arg1=value1〈=en&theme=normal
which, apart from the 〈 bit, works.
If I type in the following:
http://www.blahblah.com/a_page.asp?arg1=value1&lang=en&theme=normal
the VF does not de-reference. However, I (or rather the business users) should not have to do this IMO.
To reiterate, what I think is wrong is that the string &lang, which is
not
an entity reference is treated by VF as if it were.
Adam Stoller
This sounds like one of those wonderful IE "features" where Microsoft decided to "be nice" and interpret "&text" as-if it were "&text;" -- although I suppose Ektron could be doing the same thing ...
If you can test your DCT with Netscape it might help to narrow down the "culprit"...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
ela
I just tested the link you posted (
http://www.blahblah.com/a_page.asp?arg1=value1&lang=en&theme=normal
), and it doesn't get converted to anything else neither in the form nor after generating the html page, so I stick to my settings!:-)
Eldbjoerg
mike_s
Thanks for the clarification.
It's useful to know that preservechars is a child element of clean and not an attribute as described in the manual.
I think there is another issue than the one you are talking about (apologies if I misunderstand you). If I type in '&lang=en' then everything works (without adding the preservechars element to the visualformat config, by the way). It's not the preservation of & that I have a problem with - it's the conversion of '&lang=en' to '〈=en' instead of to '&lang=en'. I think the latest post (from fish) understands best what is happening.
ela
ok, I see your point!
You're rightfully more troubled by the idea that it gets converted, than a possible solution to it. My users wanted to write and see & and not & in the Html view, and that's my reason for "preserving" it in the visualformatconfig file.
I have had some other issues with VisualFormat, but have been able to find solutions/workarounds for many of them. I suppose it's difficult to offer a general tool which is perfect for everybody. All in all I find the VF a great improvement to our templates.
Cheers,
Eldbjoerg
rodigz
hi ela,
I'm encountering the same problem when the users try to add hyperlink for instance
http://www&amp;amp;amp;
If you will edit the link it will keep on adding amp;. I've tried the code that you suggested but still not working.
<preservechars value="&<>"/>
thanks.