fdo#74302: Adapt to OUString changes and set length exactly.

This was fixed in master by 4c539fac018dfd44cd8db52161a8cb930c627da7

Change-Id: I69219e643f5eff3126191220ce2b1d0e1089a93e
Reviewed-on: https://gerrit.libreoffice.org/8808
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>