on 2009 Jan 23 9:53 AM
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);
resource.updateContent(newFile);
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!
~Prachi
resolved by creating content from the string "<?xml version="1.0" encoding="ISO-8859-1"?>" + rootElement.toString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.