Test for string instead of float in encode

Only call the replace method on variables that would have it (strings). Otherwise booleans (true, false) throw an error during encoding.
Merge pull request #17 from dhcole/patch-1

Test for string instead of float in encode