On 9 November 2014 05:42, Shlomi Fish <shlo...@shlomifish.org> wrote:
> > Should work... But the data is simply not correct. > > > > It acts as a proxy, so I receive a request, I collect the data from > > the remote server (capture the packets on the wire with tcpdump), I > > send the data to the client through perl connected to STDOUT (and > > capture it on the wire with tcpdump). > > > > The entire encoding of the data received from the first tcpdump to the > > parent server, and the tcpdump to the client is WAY different... > This segment here suggests you have a stream of data which is not all in a single encoding, but perhaps, you have pure binary packets at some point in the stream, with markers saying "500 bytes from here are utf8 bytes" or something, followed by those utf8 encoded bytes. Though I haven't fully understood the problem and I'm also tired, so my tip could be a red herring. The good news is if you want to remove only 3 *bytes* from the string instead of 3 *characters* then that could be straight forward. And I believe ".\r\n" might be exactly 3 bytes regardless of unicode magics. ( That is, depending on what you're doing you could get away without the utf8 transformation, but I really don't know what I'm talking about now ) -- Kent *KENTNL* - https://metacpan.org/author/KENTNL