String utf8 size in kilobytes

I have a mimemessage in a string.
This string is utf8, i would like to know the size of this string.
String.size gives me the length in characters, but i need the size in kb
or bytes

daniel wijnands wrote:

I have a mimemessage in a string.
This string is utf8, i would like to know the size of this string.
String.size gives me the length in characters, but i need the size in kb
or bytes

String#size returns the size in bytes. String#jsize returns the number
of characters (with require ‘jcode’).

Thanks, then my method is valid, i want to know the bytes, so that’s
fine :slight_smile:

Andreas S. wrote:

daniel wijnands wrote:

I have a mimemessage in a string.
This string is utf8, i would like to know the size of this string.
String.size gives me the length in characters, but i need the size in kb
or bytes

String#size returns the size in bytes. String#jsize returns the number
of characters (with require ‘jcode’).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs