- changed the encoding function to apache.commons
- added a charset parameter