Skip to Content
Former Member
Jan 23, 2009 at 09:53 AM

Encoding for content in KM


Hi All,

I'm modifying and updating an existing file in KM. I use DOM to parse the file and update it as follows:

Element rootElem = doc.getDocumentElement();

<code to update rootElement>

Finally, I want to convert the Document or rootElement to IContent and update it in the repository. I use the following code:

IContent newContent = (IContent)MimeUtils.getContentFromString(rootElem.toString(),"text/xml");

IContent newFile = new Content(newContent.getInputStream(),"text/xml",newContent.getContentLength(),"ISO-8859-1",null);


The file is updated with the above code, however the encoding "ISO-8859-1" does not seem to be set. There are spanish characters in the file and upon opening the updated xm file in the browser, I get "Invalid character" errors for the spanish characters..

Is there an alternative method to set the encoding for the created "Content" object? Appreciate any pointers on this. Thanks!