Xmpp遇到的问题:openfire中发送某些特殊字符会断开xmpp连接的问题(3)
2015-01-28 16:27
525 查看
[java] view
plaincopyprint?
protected char more() throws IOException, XmlPullParserException {
final char codePoint = super.more(); // note - this does NOT return a codepoint now, but simply a (single byte) character!
if ((codePoint == 0x0) || // 0x0 is not allowed, but flash clients insist on sending this as the very first character of a stream. We should stop allowing this codepoint after the first byte has been parsed.
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
((codePoint >= 0x20) && (codePoint <= 0xD7FF)) ||
((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {
return codePoint;
}
throw new XmlPullParserException("Illegal XML character: " + Integer.parseInt(codePoint+"", 16));
}
由于openfire 对emoj表情的过滤导致,链接断开;因此稍微对源码做修改
[java] view
plaincopyprint?
@Override
protected char more() throws IOException, XmlPullParserException {
final char codePoint = super.more(); // note - this does NOT return a codepoint now, but simply a (single byte) character!
if ((codePoint == 0x0) || // 0x0 is not allowed, but flash clients insist on sending this as the very first character of a stream. We should stop allowing this codepoint after the first byte has been parsed.
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
//fix some emotion
((codePoint >= 0x20) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {
return codePoint;
}
throw new XmlPullParserException("Illegal XML character: " + Integer.parseInt(codePoint+"", 16));
}
plaincopyprint?
protected char more() throws IOException, XmlPullParserException {
final char codePoint = super.more(); // note - this does NOT return a codepoint now, but simply a (single byte) character!
if ((codePoint == 0x0) || // 0x0 is not allowed, but flash clients insist on sending this as the very first character of a stream. We should stop allowing this codepoint after the first byte has been parsed.
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
((codePoint >= 0x20) && (codePoint <= 0xD7FF)) ||
((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {
return codePoint;
}
throw new XmlPullParserException("Illegal XML character: " + Integer.parseInt(codePoint+"", 16));
}
由于openfire 对emoj表情的过滤导致,链接断开;因此稍微对源码做修改
[java] view
plaincopyprint?
@Override
protected char more() throws IOException, XmlPullParserException {
final char codePoint = super.more(); // note - this does NOT return a codepoint now, but simply a (single byte) character!
if ((codePoint == 0x0) || // 0x0 is not allowed, but flash clients insist on sending this as the very first character of a stream. We should stop allowing this codepoint after the first byte has been parsed.
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
//fix some emotion
((codePoint >= 0x20) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {
return codePoint;
}
throw new XmlPullParserException("Illegal XML character: " + Integer.parseInt(codePoint+"", 16));
}
相关文章推荐
- 解决openfire中发送某些特殊字符会断开xmpp连接的问题
- 解决openfire中发送某些特殊字符会断开xmpp连接的问题
- 解决openfire中发送某些特殊字符会断开xmpp连接的问题
- 遇到的问题--------C#连接数据库的语句带特殊字符时无法解析
- 遇到的问题--------C#连接数据库的语句带特殊字符时无法解析
- Sax解析xml遇到特殊字符问题
- 关于MongoDB的URL连接时用户名或密码中出现特殊字符问题
- 关于将XMPP server部署到Tomcat上的一些问题及断开连接不上解决
- 工作遇到的问题----过滤特殊字符
- Oracle 通过UTL_HTTP 发送http请求并处理发送内容中包含空格和特殊字符的问题
- Oracle 通过UTL_HTTP 发送http请求并处理发送内容中包含空格和特殊字符的问题
- perl的expect发送特殊字符问题
- c++关于结尾遇到‘\n’或其他特殊字符结束读取的问题(个人总结,大神勿喷)
- json格式的字符串转为json对象遇到特殊字符问题解决
- 关于执行Oracle下Sql语句中遇到的特殊字符问题解决办法。
- 关于xmpp连接openfire服务器的一些常见问题
- 使用split进行分割时遇到特殊字符的问题
- 解决pdf打印预览中遇到特殊字符,导出失败问题
- druid升级1.0.26遇到的连接闲置断开的问题
- XML中遇到特殊字符无法解析的问题