How to fix Invalid byte 1 of 1-byte UTF-8 sequence

后端 未结 13 1381
我寻月下人不归
我寻月下人不归 2020-11-28 13:54

I am trying to fetch the below xml from db using a java method but I am getting an error

Code used to parse the xml

DocumentBuilderFactory dbf = Docu         


        
13条回答
  •  甜味超标
    2020-11-28 14:41

    I was getting the xml as a String and using xml.getBytes() and getting this error. Changing to xml.getBytes(Charset.forName("UTF-8")) worked for me.

提交回复
热议问题