Hi all,
I want to convert a
string into bytes. I've read there are two alternatives:
a)
String s;
byte[] buf = new byte[ s.length() + 1 ];
s.getBytes( 0, s.length(), buf, 0 );
or b)
String s;
byte[] buf = s.getBytes();
whereby (a) is deprecated, but the preferred way to do it, namely (b), truncates the string.
Why does the string get truncated in (b)?
And is there some way of doing this (without using deprecated methods)?
Regards,
Diego