Feature/getresource encoding

Apis description show garbled encoding on platforms where default charset is not UTF-8.

This PR fixes this issue by forcing the serialization charset to UTF-8, and declaring it in the returned content-type; it also fixes a variety of questionable or outdated coding practices in this file.