Suggest changing this (and possibly all calls to iconv) to @iconv so that any error reports are ignored and don't interrupt the output.

The problem then is that ["comments"] is not defined when we come to read it in the output loop. It can be fixed with 
        if (!$temp) {$temp = "";}
after the call to iconv, since iconv returns false on error.