core: check that data is not NULL in function string_iconv_fprintf

(cherry picked from commit 08d2b9aaeb1df836c91d2c6a14932907d39fba9e)