Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #304 Encode string into UTF-8 bytes

Create the array of bytes data by encoding the string s in UTF-8.

using System.Text;
byte[] data = Encoding.UTF8.GetBytes(s);
data := []byte(s)
var
  data: pbyte absolute s;
data = s.encode('utf8')
data = s.bytes
let data = s.into_bytes();

New implementation...