Primefaces push encoding
Posted
by
kalaoke
on Stack Overflow
See other posts from Stack Overflow
or by kalaoke
Published on 2012-11-21T12:11:40Z
Indexed on
2013/07/02
11:05 UTC
Read the original article
Hit count: 329
I use primefaces push to write a message in a p:notificationBar. if i push a message with specials characters (like russians char), I've got '?' in my message. How can I fix this problem ? Thanks for your help.
(config : primefaces 3.4 and jsf2. All my html pages are utf8 encoding).
Here is my view code :
<p:notificationBar id="bar"
widgetVar="pushNotifBar"
position="bottom"
style="z-index: 3;border: 8px outset #AB1700;width: 97%;background: none repeat scroll 0 0 #CA837D;">
<h:form prependId="false">
<p:commandButton icon="ui-icon-close"
title="#{messages['gen.close']}"
styleClass="ui-notificationbar-close"
type="button"
onclick="pushNotifBar.hide();"/>
</h:form>
<h:panelGrid columns="1" style="width: 100%; text-align: center;">
<h:outputText id="pushNotifSummary" value="#{growlBean.summary}" style="font-size:36px;text-align:center;"/>
<h:outputText id="pushNotifDetail" value="#{growlBean.detail}" style="font-size: 20px; float: left;" />
</h:panelGrid>
</p:notificationBar>
<p:socket onMessage="handleMessage" channel="/notifications"/>
<script type="text/javascript">
function handleMessage(data) {
var substr = data.split(' %% ');
$('#pushNotifSummary').html(substr[0]);
$('#pushNotifDetail').html(substr[1]);
pushNotifBar.show();
}
</script>
and my Bean code :
public void send() {
PushContext pushContext = PushContextFactory.getDefault().getPushContext();
String var = summary + " %% " + detail;
pushContext.push("/notifications", var);
© Stack Overflow or respective owner