pear: catch encoding errors during replacing staging path in files