1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

Set IDNA Transformer in smack-java7 initializer

This commit is contained in:
Florian Schmaus 2015-01-21 00:07:37 +01:00
parent c5db012fc8
commit 607a5d0c01

View file

@ -20,6 +20,8 @@ import java.util.List;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.initializer.SmackInitializer;
import org.jivesoftware.smack.util.DNSUtil;
import org.jivesoftware.smack.util.StringTransformer;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.jivesoftware.smack.util.stringencoder.Base64UrlSafeEncoder;
import org.jivesoftware.smack.util.stringencoder.java7.Java7Base64Encoder;
@ -32,6 +34,12 @@ public class Java7SmackInitializer implements SmackInitializer {
SmackConfiguration.setDefaultHostnameVerifier(new Java7HostnameVerifier());
Base64.setEncoder(Java7Base64Encoder.getInstance());
Base64UrlSafeEncoder.setEncoder(Java7Base64UrlSafeEncoder.getInstance());
DNSUtil.setIdnaTransformer(new StringTransformer() {
@Override
public String transform(String string) {
return java.net.IDN.toASCII(string);
}
});
return null;
}