[DBD::Pg] More sv utf8 tweaks

dbdpg-commits-gENoVmVU/[email protected] Sun, 1 Dec 2013 23:48:42 -0500
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]>

More sv utf8 tweaks

---
 dbdimp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index b3eee86..5378244 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -287,7 +287,7 @@ static void pg_error (pTHX_ SV * h, int error_num, const char * error_msg)
 
 	/* Set as utf-8 */
 	if (imp_dbh->pg_utf8_flag)
-		SvUTF8_on(DBIc_ERRSTR(imp_xxh));
+		sv_utf8_upgrade(DBIc_ERRSTR(imp_xxh));
 
 	if (TEND_slow) TRC(DBILOGFP, "%sEnd pg_error\n", THEADER_slow);
 
@@ -1151,8 +1151,7 @@ SV * dbd_st_FETCH_attrib (SV * sth, imp_sth_t * imp_sth, SV * keysv)
 				TRACE_PQFNAME;
 				fieldname = PQfname(imp_sth->result, fields);
 				sv_fieldname = newSVpv(fieldname,0);
-				if (is_high_bit_set(aTHX_ (unsigned char *)fieldname, strlen(fieldname)) && is_utf8_string((unsigned char *)fieldname, strlen(fieldname)))
-					SvUTF8_on(sv_fieldname);
+				sv_utf8_upgrade(sv_fieldname);
 				(void)av_store(av, fields, sv_fieldname);
 			}
 		}
@@ -2755,7 +2754,7 @@ static SV * pg_destringify_array(pTHX_ imp_dbh_t *imp_dbh, unsigned char * input
 				else {
 					SV *sv = newSVpvn(string, section_size);
 					if (imp_dbh->pg_utf8_flag) {
-						SvUTF8_on(sv);
+						sv_utf8_upgrade(sv);
 					}
 					av_push(currentav, sv);
 
-- 
1.8.4