Hi all,
I'm developing a site which will be available in two different
languages - English and Gaelic. I've localised the pages and can
change easily between the two different versions, however, many terms
in Gaelic include diacritic marks on some of the characters, for
example the word for 'song' translates as 'òran'.
When the string I want to display comes directly from a field in my
Solr database, I don't have any problems and the accented character is
displayed correctly on the page. The problem comes when I need to
hard-code the string into a Java file and then display that string in
my Tapestry 5 template.
I know I can use the OutputRaw element, and most of the time it works
fine, but I can't use that inside an alt tag for my images.
Consider the following snippets.
Results.java:
....
String genreGD = "Òran"; //genreGD will change depending on the
English version pulled from the database
return genreGD;
....
Results.tml:
....
<img src="/images/${thisResult.genre}.jpg" alt="${thisResult.genreGD}
icon" title="${thisResult.genreGD}" />
....
When I hover the mouse over the image or view page source, I get two
unknown characters where the 'O grave' should be, implying some
character set encoding problem somewhere.
My Java file and template file are UTF-8 and the template declares
itself as such. The browsers I've tested (Safari, FF, IE) all detect
the correct encoding.
If I set the genreGD string in my java file to "Òran", then the
entity is carried over entirely and presented to the user exactly like
that - ie the ampersand, entity name and semicolon appear to the user.
Changing
alt="${thisResult.genreGD} icon"
to
alt="<t:outputraw value='thisResult.genreGD' /> icon"
won't work because you can't nest elements/components.
So, I'm stuck! Can anyone suggest a way out please? Adding a Gaelic
genre field to the database isn't an option and wouldn't solve the
real problem anyway. Essentially I think all I want to do is stop the
ampersand from being HTML encoded during the display phase. Can that
be done?
Many thanks for your help.
Cheers,
Mark
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org