This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

& :-(

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form written in asp (using XMLDOM techniques), everything works perfectly, except...if the input string contains "&", it will expands as "& amp;" entity reference, which I do not want since I wish to store as is otherwise Unicode characters wouldn't be able to show up on the browser properly.
The alternative solution is to write a script to do a search and replace but...it's inefficient since the contents are changing all the time!!!
Any ideas are very much appreciate...
------------------
T.T
[This message has been edited by Trina Thach (edited June 21, 2001).]
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to read this article about handling special entities. It addresses the exact same problem you're talking about.
Hope that helps!
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Trina Thach
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, since the input says as "& #7848;" (no whitespace in between) being stored as "& amp;#7848;" - automatically converted by the parser...we eventually end up showing "Ẩ" on the browser, which is totally wrong.
All I need is to be able to save the input exactly as it is (do not expand it).
------------------
T.T
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trina, have you tried to enclose user input in CDATA section? Entities in CDATA section should not be expanded.
 
Trina Thach
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rita, The whole idea is to make sure the browser renders it properly, and we know that everything in the CDATA section will be ignored by the browser so...we end up the same problem.

------------------
T.T
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ha! You figured out my name!
Trina, I do not quite understand how you show user input, I assumed that you somehow store it in XML and then apply XSLT stylesheet to render the content.
In this case, if you have
<someElement><![CDATA[ &#56; TEXT ]]></someElement>
in XML,
and apply
<xsl:value-of select="someElement" disable-output-escaping="yes" />
then the browser shows �8�, which is the correct representation for ASCII 56.
 
Trina Thach
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rita, Remember a week or 2 back? I sent you an email regarding IBM XML Cert. I did look at your profile...that's how I know your name.
You see, I should use XSLT to produce HTML but I use XSL for XML to show on the web (for a special reason). Anyway, the problem is solved.
Thank you all.

------------------
T.T
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!