As-is, this won't work for unicode strings, but we can address unicode support separately (or users can handle that case themselves).