[MPlayer-dev-eng] [PATCH] libmpdemux/asf_mmst_streaming.c: fixed calling iconv_open with correct encoding information

Wang WenRui wangwr at ustc.edu
Sat Apr 17 19:04:18 CEST 2004


Hi:

   About 6 months ago I posted a patch[1] here fixing mms url encoding
   with multibyte characters, and it is accepted.

   But the committed code(not same as my patch) is not correct and thus
   not working. The from_code parameter of iconv_open is
   "setlocale(LC_CTYPE, NULL)" which returns sth like "zh_CN.GBK" which
   is not charset.  nl_langinfo(CODESET) should be used. It returns the
   correct charset for conversion(GBK).

   The new patch against current cvs is in the attachment and is tested
   working. Please commit it, thanks.  Please CC me, I am not on this
   list.

[1] http://www1.mplayerhq.hu/pipermail/mplayer-dev-eng/2003-October/021030.html
-------------- next part --------------
--- mplayer-1.0-pre3cvs20040404.orig/libmpdemux/asf_mmst_streaming.c	2004-04-04 21:32:21.000000000 +0800
+++ mplayer-1.0-pre3cvs20040404/libmpdemux/asf_mmst_streaming.c	2004-04-18 00:59:47.000000000 +0800
@@ -24,6 +24,7 @@
 
 #ifdef USE_ICONV
 #include <locale.h>
+#include <langinfo.h>
 #include <iconv.h>
 #endif
 
@@ -490,7 +491,7 @@
   /* prepare for the url encoding conversion */
 #ifdef USE_ICONV
   setlocale(LC_CTYPE, "");
-  url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
+  url_conv = iconv_open("UTF-16LE", nl_langinfo(CODESET));
 #endif
 
   snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);


More information about the MPlayer-dev-eng mailing list