Reputation: 63
I want that Apache Jena generates an XML with
<?xml version="1.0" encoding="UTF-8"?>
My code:
RDFWriter writer = myJenaModel.getWriter("RDF/XML-ABBREV");
writer.setProperty("showXmlDeclaration", "true");
FileOutputStream fos = new FileOutputStream(filepath);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
writer.write(myJenaModel, osw, null);
only generates
<?xml version="1.0"?>
But, if I change
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
to
OutputStreamWriter osw = new OutputStreamWriter(fos, "ISO-8859-1");
it generates
<?xml version="1.0" encoding="ISO-8859-1"?>
as expected.
I tried to follow the instruction in Jena documentation, but had no success.
Does anyone know how can I make Jena generate my RDF/XML with the UTF-8 encoding declaration?
Upvotes: 4
Views: 595