[PHP-DEV] iconv patch...

2001-03-09 Thread Ondrej Sury


I think that UTF-8 is better choice as default encoding ;-) And because I
couldn't compile this module, I have added php_iconv_init_globals and put
it in ZEND_INIT_MODULE_GLOBALS.  (I have inspired by mysql module, so this
shouldn't be neccessary correct.)

ondrej@druid:~/Projects/php/php-4.0.5/ext/iconv$ cvs diff -u php_iconv.h iconv.c 
Index: php_iconv.h
===
RCS file: /repository/php4/ext/iconv/php_iconv.h,v
retrieving revision 1.3
diff -u -u -r1.3 php_iconv.h
--- php_iconv.h 2001/02/26 06:06:57 1.3
+++ php_iconv.h 2001/03/09 17:24:40
@@ -61,9 +61,9 @@
 #define ICONVLS_FETCH()
 #endif
 
-#define ICONV_INPUT_ENCODING "ISO-8859-1" 
-#define ICONV_OUTPUT_ENCODING "ISO-8859-1"
-#define ICONV_INTERNAL_ENCODING "ISO-8859-1" 
+#define ICONV_INPUT_ENCODING "UTF-8" 
+#define ICONV_OUTPUT_ENCODING "UTF-8"
+#define ICONV_INTERNAL_ENCODING "UTF-8" 
 
 #endif /* PHP_ICONV_H */
 
Index: iconv.c
===
RCS file: /repository/php4/ext/iconv/iconv.c,v
retrieving revision 1.7
diff -u -u -r1.7 iconv.c
--- iconv.c 2001/02/26 15:41:38 1.7
+++ iconv.c 2001/03/09 17:24:41
@@ -1,3 +1,4 @@
+
 /*
+--+
| PHP version 4.0  |
@@ -76,10 +77,16 @@
 STD_PHP_INI_ENTRY("iconv.internal_encoding",   
ICONV_INTERNAL_ENCODING,PHP_INI_ALL,
OnUpdateString,  internal_encoding, zend_iconv_globals,  
iconv_globals)
 PHP_INI_END()
 
+static void php_iconv_init_globals(zend_iconv_globals *iconv_globals)
+{
+   iconv_globals->input_encoding = ICONV_INPUT_ENCODING;
+   iconv_globals->output_encoding = ICONV_OUTPUT_ENCODING;
+   iconv_globals->internal_encoding = ICONV_INTERNAL_ENCODING;
+}
 
 PHP_MINIT_FUNCTION(iconv)
 {
-   ZEND_INIT_MODULE_GLOBALS(iconv, NULL, NULL);
+   ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
REGISTER_INI_ENTRIES();
return SUCCESS;
 }

-- 
Ondřej Surý <[EMAIL PROTECTED]> Globe Internet s.r.o. http://globe.cz/
Tel: +420235365000   Fax: +420235365009 Pláničkova 1, 162 00 Praha 6
Mob: +420605204544   ICQ: 24944126 Mapa: http://globe.namape.cz/
GPG fingerprint:  CC91 8F02 8CDE 911A 933F  AE52 F4E6 6A7C C20D F273

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] iconv patch...

2001-03-09 Thread Rui Hirokawa



On 09 Mar 2001 18:31:07 +0100
Ondrej Sury <[EMAIL PROTECTED]> wrote:

> 
> I think that UTF-8 is better choice as default encoding ;-) And because I
> couldn't compile this module, I have added php_iconv_init_globals and put
> it in ZEND_INIT_MODULE_GLOBALS.  (I have inspired by mysql module, so this
> shouldn't be neccessary correct.)

I personaly agree with your choice because I am using multibyte encoding (japanese) as 
my native language.
But some other modules like ext/xml are using ISO-8859-1 as default encoding now.
You can easily change these encoding settings using php.ini as follows,

[iconv]
iconv.internal_encoding = "UTF-8"
iconv.output_encoding = "UTF-8"

The iconv.input_encoding encoding has no meaning now.
I have a plan to add encoding translation capability between input encoding and 
internal encoding in http input (POST/GET/Cookie) parser.

-- 
--
Rui Hirokawa <[EMAIL PROTECTED]>
maintainer of japanese PHP manual <[EMAIL PROTECTED]>

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] ICONV patch for bug 14423

2002-03-02 Thread Dan Kalowsky

I need a review bug #14423 (http://bugs.php.net/bug.php?id=14423&edit=1)

I think I've figured out what is wrong, but unfortunately I cannot do a
buildconf on the machine I'm on currently (libtool is limited to 1.3, not
1.4).

So if someone can try this patch out and comment on any corrections for
it, I'd appriciate it :)  You'll find the patch attached to the email.
While this bug is limited to the FreeBSD platform, this patch will effect
the building on all machines (alters the config.m4).  So if at least one
other OS could test it out as well, I'd appriciate it.


>---<
Dan Kalowsky"Tonight I think I'll walk alone.
http://www.deadmime.org/~dankI'll find soul as I go home."
[EMAIL PROTECTED]- "Temptation", New Order


? diff.iconv
Index: config.m4
===
RCS file: /repository/php4/ext/iconv/config.m4,v
retrieving revision 1.7
diff -u -r1.7 config.m4
--- config.m4   30 Nov 2001 18:59:38 -  1.7
+++ config.m4   3 Mar 2002 06:24:44 -
@@ -7,15 +7,27 @@
 
 if test "$PHP_ICONV" != "no"; then
 
+dnl This is a fix for why FreeBSD does not work with ICONV
+dnl It seems libtool checks for libiconv_open which only exists in
+dnl the giconv series of files under FreeBSD
+
+  ac_os_uname = `uname -s 2>/dev/null`
+
+  if test "$ac_os_uname" = "FreeBSD"; then
+   lib_name=giconv
+  else
+   lib_name=iconv
+  fi
+
   for i in /usr /usr/local $PHP_ICONV; do
-test -r $i/include/iconv.h && ICONV_DIR=$i
+test -r $i/include/${lib_name}.h && ICONV_DIR=$i
   done
 
   if test -z "$ICONV_DIR"; then
 AC_MSG_ERROR(Please reinstall the iconv library.)
   fi
   
-  if test -f $ICONV_DIR/lib/libconv.a -o -f 
$ICONV_DIR/lib/libiconv.$SHLIB_SUFFIX_NAME ; then
+  if test -f $ICONV_DIR/lib/libconv.a -o -f 
+$ICONV_DIR/lib/lib${lib_name}.$SHLIB_SUFFIX_NAME ; then
 PHP_ADD_LIBRARY_WITH_PATH(iconv, $ICONV_DIR/lib, ICONV_SHARED_LIBADD)
 AC_CHECK_LIB(iconv, libiconv_open, [
AC_DEFINE(HAVE_ICONV, 1, [ ])
Index: php_iconv.h
===
RCS file: /repository/php4/ext/iconv/php_iconv.h,v
retrieving revision 1.9
diff -u -r1.9 php_iconv.h
--- php_iconv.h 13 Dec 2001 14:31:16 -  1.9
+++ php_iconv.h 3 Mar 2002 06:24:44 -
@@ -26,8 +26,9 @@
 #define PHP_ICONV_API
 #endif
 
+#if HAVE_ICONV
 extern zend_module_entry iconv_module_entry;
-#define phpext_iconv_ptr &iconv_module_entry
+#define iconv_module_ptr &iconv_module_entry;
 
 PHP_MINIT_FUNCTION(miconv);
 PHP_MSHUTDOWN_FUNCTION(miconv);
@@ -53,6 +54,14 @@
 #define ICONV_INPUT_ENCODING "ISO-8859-1" 
 #define ICONV_OUTPUT_ENCODING "ISO-8859-1"
 #define ICONV_INTERNAL_ENCODING "ISO-8859-1" 
+
+#else
+
+#define iconv_module_ptr NULL
+
+#endif /* HAVE_ICONV */
+
+#define phpext_iconv_ptr iconv_module_entry
 
 #endif /* PHP_ICONV_H */
 


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] ICONV patch for bug 14423

2002-03-03 Thread Derick Rethans

Hello,

attached is a fixed diff, it works on Linux now (RH 7.1).

Derick

On Sun, 3 Mar 2002, Dan Kalowsky wrote:

> I need a review bug #14423 (http://bugs.php.net/bug.php?id=14423&edit=1)
>
> I think I've figured out what is wrong, but unfortunately I cannot do a
> buildconf on the machine I'm on currently (libtool is limited to 1.3, not
> 1.4).
>
> So if someone can try this patch out and comment on any corrections for
> it, I'd appriciate it :)  You'll find the patch attached to the email.
> While this bug is limited to the FreeBSD platform, this patch will effect
> the building on all machines (alters the config.m4).  So if at least one
> other OS could test it out as well, I'd appriciate it.
>
>
> >---<
> Dan Kalowsky  "Tonight I think I'll walk alone.
> http://www.deadmime.org/~dank  I'll find soul as I go home."
> [EMAIL PROTECTED]  - "Temptation", New Order
>

Derick Rethans

-
PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
 SRM: Site Resource Manager - www.vl-srm.net
-


? iconv.diff
Index: config.m4
===
RCS file: /repository/php4/ext/iconv/config.m4,v
retrieving revision 1.7
diff -u -r1.7 config.m4
--- config.m4   30 Nov 2001 18:59:38 -  1.7
+++ config.m4   3 Mar 2002 18:11:24 -
@@ -7,15 +7,27 @@
 
 if test "$PHP_ICONV" != "no"; then
 
+dnl This is a fix for why FreeBSD does not work with ICONV
+dnl It seems libtool checks for libiconv_open which only exists in
+dnl the giconv series of files under FreeBSD
+
+  ac_os_uname=`uname -s 2>/dev/null`
+
+  if test "$ac_os_uname" = "FreeBSD"; then
+   lib_name=giconv
+  else
+   lib_name=iconv
+  fi
+
   for i in /usr /usr/local $PHP_ICONV; do
-test -r $i/include/iconv.h && ICONV_DIR=$i
+test -r $i/include/${lib_name}.h && ICONV_DIR=$i
   done
 
   if test -z "$ICONV_DIR"; then
 AC_MSG_ERROR(Please reinstall the iconv library.)
   fi
   
-  if test -f $ICONV_DIR/lib/libconv.a -o -f 
$ICONV_DIR/lib/libiconv.$SHLIB_SUFFIX_NAME ; then
+  if test -f $ICONV_DIR/lib/libconv.a -o -f 
+$ICONV_DIR/lib/lib${lib_name}.$SHLIB_SUFFIX_NAME ; then
 PHP_ADD_LIBRARY_WITH_PATH(iconv, $ICONV_DIR/lib, ICONV_SHARED_LIBADD)
 AC_CHECK_LIB(iconv, libiconv_open, [
AC_DEFINE(HAVE_ICONV, 1, [ ])
Index: php_iconv.h
===
RCS file: /repository/php4/ext/iconv/php_iconv.h,v
retrieving revision 1.9
diff -u -r1.9 php_iconv.h
--- php_iconv.h 13 Dec 2001 14:31:16 -  1.9
+++ php_iconv.h 3 Mar 2002 18:11:24 -
@@ -26,8 +26,9 @@
 #define PHP_ICONV_API
 #endif
 
+#if HAVE_ICONV
 extern zend_module_entry iconv_module_entry;
-#define phpext_iconv_ptr &iconv_module_entry
+#define iconv_module_ptr &iconv_module_entry
 
 PHP_MINIT_FUNCTION(miconv);
 PHP_MSHUTDOWN_FUNCTION(miconv);
@@ -53,6 +54,14 @@
 #define ICONV_INPUT_ENCODING "ISO-8859-1" 
 #define ICONV_OUTPUT_ENCODING "ISO-8859-1"
 #define ICONV_INTERNAL_ENCODING "ISO-8859-1" 
+
+#else
+
+#define iconv_module_ptr NULL
+
+#endif /* HAVE_ICONV */
+
+#define phpext_iconv_ptr iconv_module_ptr
 
 #endif /* PHP_ICONV_H */
 


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] ICONV patch for bug 14423

2002-03-03 Thread Dan Kalowsky

Um yeah, this is the patch I ment to send initially :)

If no comments/concerns are heard within 24 hours, you'll find this patch
in the cvs.

On Sun, 3 Mar 2002, Derick Rethans wrote:

> Hello,
>
> attached is a fixed diff, it works on Linux now (RH 7.1).
>
> Derick
>
> On Sun, 3 Mar 2002, Dan Kalowsky wrote:
>
> > I need a review bug #14423 (http://bugs.php.net/bug.php?id=14423&edit=1)
> >
> > I think I've figured out what is wrong, but unfortunately I cannot do a
> > buildconf on the machine I'm on currently (libtool is limited to 1.3, not
> > 1.4).
> >
> > So if someone can try this patch out and comment on any corrections for
> > it, I'd appriciate it :)  You'll find the patch attached to the email.
> > While this bug is limited to the FreeBSD platform, this patch will effect
> > the building on all machines (alters the config.m4).  So if at least one
> > other OS could test it out as well, I'd appriciate it.
> >
> >
> > >---<
> > Dan Kalowsky"Tonight I think I'll walk alone.
> > http://www.deadmime.org/~dankI'll find soul as I go home."
> > [EMAIL PROTECTED]- "Temptation", New Order
> >
>
> Derick Rethans
>
> -
> PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
>  SRM: Site Resource Manager - www.vl-srm.net
> -
>

>---<
Dan Kalowsky"Tonight I think I'll walk alone.
http://www.deadmime.org/~dankI'll find soul as I go home."
[EMAIL PROTECTED]- "Temptation", New Order


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php