added exception handling for string encoding anomalies