The problem in
uint32_t st = FRENewObjectFromUTF8([self length], (const uint8_t *)[self UTF8String], &rv);
is that [self length]
is the number of Unicode characters in the string, and not the
number of UTF-8 bytes in [self UTF8String]
.
In your case "Stanisław"
has 9 Unicode characters which are converted to 10 UTF-8 bytes.
Your code would send only the first 9 bytes, which is the "shortening" that you
observed.
Therefore you should replace your code with
const char *utf8 = [self UTF8String];
uint32_t st = FRENewObjectFromUTF8(strlen(utf8), (const uint8_t *)utf8, &rv);