Fix bug with non-8bit characters in stringToData

stringToData was assuming a size of 8bits for each character, and would
write an incorrect size for strings containing non-8bit characters.
Aka strlen != sizeof bug