NutzCN Logo
问答 nutzwx 多个中文字符出错
发布于 3073天前 作者 qq_e7045647 1924 次浏览 复制 上一个帖子 下一个帖子
标签:

一个中文没事 多个就出问题

java.lang.RuntimeException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。 at org.nutz.lang.Lang.wrapThrow(Lang.java:153) at org.nutz.lang.Xmls.xml(Xmls.java:62) at org.nutz.weixin.util.Wxs.convert(Wxs.java:163) at org.nutz.weixin.util.Wxs.convert(Wxs.java:178) at org.nutz.weixin.util.Wxs.handle(Wxs.java:623) at com.zhishang.weixin.module.WxModule.msgIn(WxModule.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)

4 回复

确保运行在UTF-8环境

@wendal 已经在utf8下了啊
我用的是gradle

tasks.withType(JavaCompile) {
    options.encoding = "UTF-8"
}

主模块
@Encoding(input="utf-8",output="utf-8")
都加过了

@wendal 为什么一个中文字符的话是可以的, 多个就不行了?

@qq_e7045647 这是gradle编译时的编码,不是运行时

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部