i need to convert a string from a text field to bytes. How can i do that?
Reason: The text on the textbox will be sent by SMS to the client, and I've limited the text to 160chars but if i put special chars like @€£‰¶÷‰‰€£@ it will be larger than 256 bytes (that's the size of an sms).
So i need to remove from 256 the converted text to bytes, and convert the result to normal chars length.
Example:
var charsleft = toChars(256 - toBytes(mystring));
EDIT:
REASON to be on Javascript: i have an line saying something like this "XXX chars left"