Committed by Greg Sabino Mullane <[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

Reply via email to