Index: plperl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plperl/plperl.c,v
retrieving revision 1.98
diff -c -r1.98 plperl.c
*** plperl.c	29 Dec 2005 14:28:31 -0000	1.98
--- plperl.c	8 Jan 2006 00:49:57 -0000
***************
*** 45,50 ****
--- 45,51 ----
  #include <ctype.h>
  #include <fcntl.h>
  #include <unistd.h>
+ #include <stdlib.h>
  
  /* postgreSQL stuff */
  #include "commands/trigger.h"
***************
*** 60,65 ****
--- 61,72 ----
  extern DLLIMPORT bool check_function_bodies;
  
  /* perl stuff */
+ 
+ /* prevent perl headers from hijacking stdio and lots of other stuff */
+ #ifdef WIN32
+ #define WIN32IO_IS_STDIO
+ #endif
+ 
  #include "EXTERN.h"
  #include "perl.h"
  #include "XSUB.h"
***************
*** 263,268 ****
--- 270,297 ----
  		"", "-e", PERLBOOT
  	};
  
+ 
+ 	char lang_buf[256], col_buf[256] ;
+ 	char * env_entry;
+ 
+ 	lang_buf[0] = col_buf[0] = '\0';
+ 
+ 	env_entry= getenv("LANG");
+ 
+ 	if (env_entry && strlen(env_entry) > 0)
+ 	{
+ 		snprintf(lang_buf,256, "LANG=%s", env_entry);
+ 		unsetenv("LANG");
+ 	}
+ 
+ 	env_entry = getenv("LC_COLLATE");
+ 
+ 	if (env_entry && strlen(env_entry) > 0)
+ 	{
+ 		snprintf(col_buf,256,"LC_COLLATE=%s",env_entry);
+ 		unsetenv("LC_COLLATE");
+ 	}
+ 
  	plperl_interp = perl_alloc();
  	if (!plperl_interp)
  		elog(ERROR, "could not allocate Perl interpreter");
***************
*** 272,277 ****
--- 301,311 ----
  	perl_run(plperl_interp);
  
  	plperl_proc_hash = newHV();
+ 
+ 	if (strlen(lang_buf) > 0)
+ 		putenv(lang_buf);
+ 	if(strlen(col_buf) > 0)
+ 		putenv(col_buf);
  }
  
  
