|Do you know where your variables are?|
What does utf8::upgrade actually do.by syphilis (Archbishop)
|on Feb 17, 2021 at 06:02 UTC||Need Help??|
syphilis has asked for the wisdom of the Perl Monks concerning the following question:
A few days ago I noticed https://rt.cpan.org/Ticket/Display.html?id=123268 which had been sitting there for over 3 years.
I don't have any experience with utf8, but I fiddled around with utf8::upgrade() and utf8::downgrade() and decided that utf8::upgrade was actually altering the bytes of the string - or, to be more precise, altering those bytes whose value was greater than 0x7f.
But now I'm wondering if I was wrong - if, instead, all of the bytes of the string remain unchanged, and it's just the encoding that changes.
If that's so, then the person who filed the report is quite right to be surprised that the utf8::upgrade changed the returned value - and Rmpz_import() should probably change to reading the string in with SvPVbyte_nolen instead of SvPV_nolen.
Explanations that might reduce my confusion are most welcome ;-)