- added fixed encoding to avoid text conversion errors
- converted to ruby 1.9+ switches