fix logging encoding issues in api