+ if (psz_charset == NULL)
+ {
+ psz_charset = strdup ("UTF-8");
+ msg_Dbg (p_dec, "trying hard-coded character encoding: %s",
+ psz_charset ?: "error");
+ }
+
+ if (psz_charset == NULL)
+ {
+ free (p_sys);
+ return VLC_ENOMEM;
+ }
+
+ if (strcasecmp (psz_charset, "UTF-8") && strcasecmp (psz_charset, "utf8"))
+ {
+ p_sys->iconv_handle = vlc_iconv_open ("UTF-8", psz_charset);
+ if (p_sys->iconv_handle == (vlc_iconv_t)(-1))
+ msg_Err (p_dec, "cannot convert from %s: %s", psz_charset,
+ strerror (errno));
+ }
+ free (psz_charset);
+