Producing valid XML with Java and UTF-8 encoding

前端 未结 2 1002
无人共我
无人共我 2020-12-02 19:04

I am using JAXP to generate and parse an XML document from which some fields are loaded from a database.

Code to serialize the XML:

DocumentBuilder b         


        
2条回答
  •  無奈伤痛
    2020-12-02 19:40

    Well, for sure 0xFC and 0xF6 are not valid UTF-8 characters. These should have been finnesed to the two byte sequences: 0x3CBC and 0x3CB6.

    Most likely the problem is with the original source of the characters being defined as UTF-8 when they are not.

提交回复
热议问题