Handle encoding errors for platform_vasprintf