File: 030_fix_pgsql_client_encoding.diff

package info (click to toggle)
phpbb2 2.0.21-6
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 4,224 kB
  • ctags: 12
  • sloc: sh: 476; makefile: 108; perl: 29; php: 21
file content (16 lines) | stat: -rw-r--r-- 719 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff -ur phpBB2.orig/db/postgres7.php phpBB2/db/postgres7.php
--- phpBB2.orig/db/postgres7.php	2006-06-09 16:29:41.000000000 +0200
+++ phpBB2/db/postgres7.php	2006-07-03 14:38:42.000000000 +0200
@@ -78,6 +78,12 @@
 
 		$this->db_connect_id = ( $this->persistency ) ? pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
 
+		# Use the same encoding for our connection to the DB as we do
+		# for talking with clients.  That allows us to pass in user
+		# input containing non-ascii chars into the database properly.
+		$encoding = ini_get ( 'default_charset' );
+		pg_set_client_encoding ( $this->db_connect_id, $encoding );
+
 		return ( $this->db_connect_id ) ? $this->db_connect_id : false;
 	}