I\'m writing a module that is supposed to be able to export transaction records in BankOne format.
Here is the specification of the format
Here is an example
This is happening because 'Ã'
is a multi-byte character (4 bytes long), and str_pad
is counting bytes rather than logical characters.
This is why you are missing three spaces, str_pad
is counting 'Ã'
as 4 single byte characters instead of one multi-byte one.
Try this function (credit here).
function mb_str_pad( $input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
$diff = strlen( $input ) - mb_strlen( $input );
return str_pad( $input, $pad_length + $diff, $pad_string, $pad_type );
}
?>