Re: BText and Unicode-encoded characters
Richard Kunze <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Organization | Tivano Software GmbH |
| Message-ID | <[email protected]> |
On Wednesday 12 February 2003 09:41, Timo H Jarvinen wrote: > When setAllowMarkupInText(false), it works. Unfortunately, we are using > BText to add content with arbitrary markup to the page. This kind of > content would be difficult to render using standard Barracuda components. > Therefore, we really need setAllowMarkupInText(true). > > Shawn Wilson wrote: > Okay so that's one point. Now, it sounds like Timo wants something like > "\u03a3\u03c5" to translate into the HTML entities of "Συ". > > That's exactly what I would like to have. Sounds a bit like you want to eat your cake and keep it too :-) As I've said in a previous mail, a CDATA section (which doesn't exist in HTML so XMLC can recycle it for that purpose) in the DOM tells the XMLC HTML renderer to output that particular DOM node as is, without applying the usual automatic escapes. On the one hand, this means that "<" and ">" aren't escaped to "<" and ">", which allows you to put markup in a CDATA section. On the other hand, it means that characters that can't be displayed in the character set used for output aren't escaped to the corresponding HTML entities. To get it working nonetheless, you've got three (well, two realistic and one that's probably not going to work :-) options: - Don't use allowMarkupInText(true), but instead parse your markup snippets into small DOM trees and insert those into the page - Escape the offending characters by hand. org.enhydra.xml.io.HTMLEntities provides a couple of convenience methods for converting characters to named entities, and you can get the code for converting characters to numeric entities from org.enhydra.xml.io.HTMLFormatter.writeCharacter(). - Make sure all browsers accessing your application accept UTF-8 as transport encoding (most modern browsers do, but must be configured to do so), and tell Barracuda to use UTF-8 for sending HTML pages. Hope this helps, Richard -- Richard Kunze [ t]ivano Software, Bahnhofstr. 18, 63263 Neu-Isenburg Tel.: +49 6102 80 99 07 - 0, Fax.: +49 6102 80 99 07 - 1 http://www.tivano.de, [email protected]
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA+SjHB86Aqb3OZfF4RAuY3AKDZS/LhTZVOPF5HObHW4ECniDqVtACdHo3p JZ+riDaGgTqOkLnMd13tkhw= =Z/a9 -----END PGP SIGNATURE-----