1 Attachment(s)
Problem with XTemplate and html entities
Hi all, I have a problem that is driving me crazy.
I have the method redditivita() in a i18 Constants class that returns the String "Redditività":
Code:
...
/**
* Translated "Redditività".
*
* @return translated "Redditività"
*/
@DefaultStringValue("Redditività")
@Key("redditivita")
String redditivita();
...
As you can see inside this string there is the html entity "à"
When i try to use it in a XTemplate the result is as follow:
Attachment 41938
while I expect the text of the label is RedditivitÃ
This is my code:
Code:
...
interface DetailRenderer extends XTemplates {
@XTemplate(source = "SectionDetail.html")
public SafeHtml renderItem(SectionItem section);
}
...
final DetailRenderer r = GWT.create(DetailRenderer.class);
IsideCommonCssBundle.INSTANCE.listViewStyle().ensureInjected();
ListViewStyle style = IsideCommonCssBundle.INSTANCE.listViewStyle();
ListViewCustomAppearance<SectionItem> appearance = new ListViewCustomAppearance<SectionItem>("." + style.thumbWrap()) {
@Override
public void render(SafeHtmlBuilder builder) {
builder.appendHtmlConstant("<div class='" + ListView.getStandardResources().css().view() + "' id='list-view'></div>");
}
@Override
public void renderEnd(SafeHtmlBuilder builder) {
String markup = new StringBuilder("<div class=\"").append(CommonStyles.get().clear()).append("\"></div>").toString();
builder.appendHtmlConstant(markup);
}
@Override
public void renderItem(SafeHtmlBuilder builder, SafeHtml content) {
builder.append(content);
}
};
listView = new ListView<SectionItem, SectionItem>(listStore, new IdentityValueProvider<SectionItem>() {
@Override
public void setValue(SectionItem object, SectionItem value) {
}
}, appearance);
listView.setCell(new SimpleSafeHtmlCell<SectionItem>(new AbstractSafeHtmlRenderer<SectionItem>() {
public SafeHtml render(SectionItem object) {
SafeHtml h = r.renderItem(object);
return h;
}
}));
and this is my template file:
HTML Code:
<div class="thumb-wrap">
<div class="thumb"><img src="{section.iconUrl}" title="{section.name}"></div>
<span class="x-editable">{section.name}</span></div>
section.name is the field containing the result of redditivita() method from i18n Constants class.
Where is the problem?