BUG: Fix GSO values when writing latin-1 strLs
The size calculation of the string is incorrect when writing characters
that have a different encoding in latin-1 and utf-8. The utf-8 size
needs to be written instead of the latin-1 size.

- [x] closes #23573
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry
