Fix #6693: Calculate correct length when pasting strings with multi-byte unicode characters

Was using length(input), should have been sizeof(input).