in reply to Re^2: CR-LF Newlines as 2 distinct characters
in thread CR-LF Newlines as 2 distinct characters

Ah, I see. I don't know what you need to "mangle", exactly, but since you seem to have UTF16-like representations of purely 8-bit chars, you might take a risk and do s[\x00(?<!\x00)][]gs; on the way in (0) to make a "real ASCII" string. You can then mangle the 8-bit ASCII string comfortably.

Then do something like this on the way out:

$str = join( '', map{ "\x00$_" } split('',$str) );

That should pad you appropriately. It's cheating, but it might work.

[0]: The negative lookbehind is to make sure a "\x00\x00" doesn't get chopped away; it's untested, though.

<radiant.matrix>
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet