string_bytes: use extern for length and write utf8

If the string is external then the length can be quickly retrieved. This
is especially faster for large strings that are being treated as UTF8.
Also, if the string is external then there's no need for a full
String::WriteUtf8 operation. A simple memcpy will do.

@bnoordhuis just need a quick sign off