Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XMLStreamReader Encoding

I have some characters from the Unicode Extension B Chinese/Japanese/Korean set in my XML:

𠀀𠀁𠀂𠀃𠀄𪛔𪛕𪛖 

But when I use streamReader.getText() it returns:

Does anyone know if Java's XMLStreamReader's encoding scheme for unicode characters can be changed?

It works with common East Asian characters, just not with the ones in Unicode Extension B.

like image 660
daniely Avatar asked Aug 29 '26 08:08

daniely


1 Answers

when create XML Stream Reader, you can specify the encoding as UTF-8. Like the API below

abstract XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)

like image 124
user1006080 Avatar answered Aug 31 '26 22:08

user1006080



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!