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

后端 未结 13 1387
我寻月下人不归
我寻月下人不归 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:49

    I had this problem, but the file was in UTF-8, it was just that somehow on character had come in that was not encoded in UTF-8. To solve the problem I did what is stated in this thread, i.e. I validated the file: How to check whether a file is valid UTF-8?

    Basically you run the command:

    $ iconv -f UTF-8 your_file -o /dev/null

    And if there is something that is not encoded in UTF-8 it will give you the line and row numbers so that you can find it.

提交回复
热议问题