This already handles unicode, so shouldn't be changed to take a stringref.