Cause: When OpenSocial gadget XML definition had encoding other than the default encoding of the running VM in its XML declaration, an "Unknown error" was presented to the user.
Consequence: Gadget was not saved.
Fix: The declared encoding is detected, validated and used to store the XML document.
Result: An error message is presented to the user only if the XML document contains an unsupported encoding. Otherwise the there is no error message and the document is stored properly.