[Mailmunge] When reading body lines, getting confusing multiple space results

postfix at ptld.com postfix at ptld.com
Fri Sep 24 16:46:53 EDT 2021


When reading the body lines using $body->open('r') and ($line = 
$io->getline) on some emails with multiple spaces such as "hello     
world" those spaces are getting converted to extended ascii characters 
chr(194)+chr(160) instead of being chr(32) spaces.

chr 104 = $VAR1 = 'h';
chr 101 = $VAR1 = 'e';
chr 108 = $VAR1 = 'l';
chr 108 = $VAR1 = 'l';
chr 111 = $VAR1 = 'o';
chr 194 = $VAR1 = '�';
chr 160 = $VAR1 = '�';
chr 194 = $VAR1 = '�';
chr 160 = $VAR1 = '�';
chr 194 = $VAR1 = '�';
chr 160 = $VAR1 = '�';
chr 194 = $VAR1 = '�';
chr 160 = $VAR1 = '�';
chr 32 = $VAR1 = ' ';
chr 119 = $VAR1 = 'w';
chr 111 = $VAR1 = 'o';
chr 114 = $VAR1 = 'r';
chr 108 = $VAR1 = 'l';
chr 100 = $VAR1 = 'd';

So when trying to match with =~ s/hello\s+world/ it fails because they 
are not seen as white spaces.
Am i missing something simple? Is there a way to keep those as spaces or 
match them as spaces?


More information about the Mailmunge mailing list