Thanks, I've update the docs. I don't know how that get left out of the example.
It would be helpful if you could open JIRA issues for the encoding issues. I don't think this is the right solution, but I'll investigate.
I've changed the source code according to you tips and it's working just fine!
Thanks, you saved my life!