I found a solution that works for me:
I needed to add a small piece of code in the saml10SuccessResponseView.
protected void renderMergedOutputModel(final Map model,
final HttpServletRequest request, final
HttpServletResponse response)
throws Exception {
...
final Collection c = new ArrayList();
String newValue =
encodeToUnicodeStandard(value
.toString());
c.add(newValue);
attribute.setValues(c);
...
private static String encodeToUnicodeStandard(String pData) {
StringBuffer encodedData = new StringBuffer();
StringBuffer sBuff = new StringBuffer(pData);
for (int i = 0; i < sBuff.length(); i++) {
char ch = sBuff.charAt(i);
int chVal = (int) ch;
// if this is a special character (ie. > 8 bits),
encode it
if (chVal > Byte.MAX_VALUE) {
encodedData.append("&#x").append(Integer.toHexString(chVal))
.append(";");
} else {
encodedData.append(ch);
}
}
return encodedData.toString();
}
enjoy!
Danny B. wrote:
>
> Hi,
>
> I am having problems with receiving special chars like
> <AttributeValue>é.ö.û.à</AttributeValue>
> Without the utf-8 filter it got in my apache log I recieved this.
> \xe9.\xf6.\xfb.\xe0 (latin)
> The php client froze on this code.
> It appears we sent the message in ISO-8859-1 instead of UTF-8. Because
> when we used utf8_encode($xml_response) in the php example, we could read
> the response.
> When I looked in my cas-java-demo, I received: ?.?.?.?
>
> So we decided to change it, to use UTF-8 character encoding
>
> Now when I look in my apache log. i see
> <AttributeValue>\xc3\xa9.\xc3\xb6.\xc3\xbb.\xc3\xa0</AttributeValue>
> When I looked in my cas-java-demo, I received: ??.??.??.??
> This is with the spring utf-8 filter.
>
> I am using:
> cas-server version 3.3.1
> cas-client version 3.1.4
>
> Server: JBoss 4.2.2. running on Ubuntu.
>
> LDAP: utf-8
>
> Steps i have undertaken:
> JBoss connector config:
> connector: added URIEncoding="UTF-8"
>
> Spring config
> Filter UTF-8
>
> Saml10SuccessResponseView
> added response.setCharacterEncoding("UTF-8");
>
> All help is very much appreciated.
>
> Thanks in advance.
>
>
--
View this message in context:
http://www.nabble.com/CAS-character-encoding-tp22475177p22541189.html
Sent from the CAS Users mailing list archive at Nabble.com.
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user