[DBD::Pg] Extend UTF-8 magic to notifications: names and payloads.

dbdpg-commits-gENoVmVU/[email protected] Fri, 7 Mar 2014 19:10:20 +0000
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]>

Extend UTF-8 magic to notifications: names and payloads.

---
 dbdimp.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index deaf049..e55dd83 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -1474,11 +1474,21 @@ SV * pg_db_pg_notifies (SV * dbh, imp_dbh_t * imp_dbh)
 	}
 
 	ret=newAV();
-	av_push(ret, newSVpv(notify->relname,0) );
+
+	SV *relnamesv = newSVpv(notify->relname, 0);
+	if (imp_dbh->pg_utf8_flag) {
+		SvUTF8_on(relnamesv);
+	}
+	av_push(ret, relnamesv);
+
 	av_push(ret, newSViv(notify->be_pid) );
-	av_push(ret, newSVpv(notify->extra,0) );
-	/* Think about utf-8 in payloads someday... */
-	
+
+	SV *payloadsv = newSVpv(notify->extra, 0);
+	if (imp_dbh->pg_utf8_flag) {
+		SvUTF8_on(payloadsv);
+	}
+	av_push(ret, payloadsv);
+
 	TRACE_PQFREEMEM;
  	PQfreemem(notify);
 
-- 
1.8.4