I needed the length of the string to write the string and its length in a binary file.
in reply to Re^4: Understanding pack and unpack changes for binary data between 5.8 and 5.10
in thread Understanding pack and unpack changes for binary data between 5.8 and 5.10
I'm only using _utf8_on in this example, in the original code, the string already had its utf8 flag on (it was coming from gtk2 (which uses utf8 everywhere), so I was expecting it to be utf8-encoded.
I understand that my code was ambiguous because it depends on the internal representation, I've written it a long time ago when I didn't have much experience in perl, and didn't really know how utf8 was handled.
But I don't think using a string in pack should result in something that depends on the internal representation of the string : the internal representation should be internal :)
Honestly, I don't like how utf8 is handled in perl, it tries to do everything automagically, but this makes things less clear.