closes #123892 by adding errors=replace when encoding unicode strings [applied]