changeset 12674:0392f36045f4

user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
author alex
date Sat, 26 Jun 2004 09:54:02 +0000
parents c1371fce7267
children 7c5dee73a7dc
files configure libmpdemux/asf_mmst_streaming.c
diffstat 2 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sat Jun 26 09:21:07 2004 +0000
+++ b/configure	Sat Jun 26 09:54:02 2004 +0000
@@ -156,6 +156,7 @@
   --enable-termios       use termios database for key codes [autodetect]
   --disable-iconv        do not use iconv(3) function [autodetect]
   --disable-setlocale    disable setlocale using in mplayer [autodetect]
+  --disable-langinfo     do not use langinfo [autodetect]
   --enable-lirc          enable LIRC (remote control) support [autodetect]
   --enable-lircc         enable LIRCCD (LIRC client daemon) input [autodetect]
   --enable-joystick      enable joystick support [disable]
@@ -1177,6 +1178,7 @@
 _dxr2=auto
 _dxr3=auto
 _iconv=auto
+_langinfo=auto
 _rtc=auto
 _ossaudio=auto
 _arts=auto
@@ -1336,6 +1338,8 @@
   --disable-dxr3)	_dxr3=no	;;
   --enable-iconv)	_iconv=yes	;;
   --disable-iconv)	_iconv=no	;;
+  --enable-langinfo)	_langinfo=yes	;;
+  --disable-langinfo)	_langinfo=no	;;
   --enable-rtc)	        _rtc=yes	;;
   --disable-rtc)	_rtc=no	        ;;
   --enable-mp1e)	_mp1e=yes	;;
@@ -2035,6 +2039,23 @@
 echores "$_iconv"
 
 
+echocheck "langinfo"
+if test "$_langinfo" = auto ; then
+  cat > $TMPC <<EOF
+#include <langinfo.h>
+int main(void) { nl_langinfo(CODESET); return 0; }
+EOF
+  _langinfo=no
+  cc_check && _langinfo=yes
+fi
+if test "$_langinfo" = yes ; then
+  _def_langinfo='#define USE_LANGINFO 1'
+else
+  _def_langinfo='#undef USE_LANGINFO'
+fi
+echores "$_langinfo"
+
+
 echocheck "language"
 test -z "$_language" && _language=$LINGUAS
 _language=`echo $_language | sed 's/,/ /g'`
@@ -6353,6 +6374,9 @@
 /* define this to use iconv(3) function to codepage conversions */
 $_def_iconv
 
+/* define this to use nl_langinfo function */
+$_def_langinfo
+
 /* define this to use RTC (/dev/rtc) for video timers (LINUX only) */
 $_def_rtc
 
--- a/libmpdemux/asf_mmst_streaming.c	Sat Jun 26 09:21:07 2004 +0000
+++ b/libmpdemux/asf_mmst_streaming.c	Sat Jun 26 09:54:02 2004 +0000
@@ -23,8 +23,11 @@
 #endif
 
 #ifdef USE_ICONV
+#include <iconv.h>
+#ifdef USE_LANGINFO
+#include <langinfo.h>
+#endif
 #include <locale.h>
-#include <iconv.h>
 #endif
 
 #include "url.h"
@@ -490,8 +493,12 @@
   /* prepare for the url encoding conversion */
 #ifdef USE_ICONV
   setlocale(LC_CTYPE, "");
+#ifdef USE_LANGINFO
+  url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
+#else
   url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
 #endif
+#endif
 
   snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);
   string_utf16 (data, str, strlen(str));