encode

Encodes c in str's encoding and appends it to str.

Throws

UTFException if c is not a valid UTF code point.

Examples

char[] s = "abcd".dup;
dchar d1 = 'a';
dchar d2 = 'ø';

encode(s, d1);
assert(s.length == 5);
assert(s == "abcda");
encode(s, d2);
assert(s.length == 7);
assert(s == "abcdaø");

Meta