in reply to Re^17: Interleaving bytes in a string quickly
in thread Interleaving bytes in a string quickly
SvPVX() performs NO COERCIONS WHATSOEVER
I know. It just doesn't necessarily return a pointer to the bytes of a byte string.
I therefore invite you to prove your assertion with code!
Well, I don't know of anything that omits the \0, so the remaining two can be shown using:
my $byte_string = "\x80\x81"; dump_sv_pvx($byte_string); utf8::upgrade($byte_string); dump_sv_pvx($byte_string);
Any function or PerlIO layer is free to do format switch, even if the string only contains bytes. It doesn't change the string at all. It's still the same string of bytes.
You didn't specify where the string came from. Maybe it came from lcss, for example, which can switch the internal format. (You discussed using lcss recently, IIRC.) If you need a specific format (and you do), SvPVX without a preceding format check is buggy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^19: Interleaving bytes in a string quickly
by BrowserUk (Patriarch) on Mar 01, 2010 at 00:34 UTC | |
by ikegami (Patriarch) on Mar 01, 2010 at 02:46 UTC | |
by BrowserUk (Patriarch) on Mar 01, 2010 at 13:46 UTC | |
by ikegami (Patriarch) on Mar 01, 2010 at 13:57 UTC | |
by BrowserUk (Patriarch) on Mar 01, 2010 at 14:20 UTC | |
|