added some methods to help encode and decode safely strings (hopefully ;) )