develooper Front page | | Postings from May 2011

Decoding data from the database in DBD

Thread Next
Martin J. Evans
May 9, 2011 11:43
Decoding data from the database in DBD
Message ID:
I've recently had an rt posted 
( after a discussion 
on stackoverflow 

In this case the Perl script is binding the columns but the data 
returned is windows-1252 and the user is having to manually 
Encode::decode all bound columns. DBD::ODBC already had a odbc_utf8_on 
( for 
a derivative of Postgres which returns bound data UTF-8 encoded but in 
that case I can just call sv_utf8_decode (in the XS) and it is converted 
in place. Initially I thought I could combine odbc_utf8_on into a new 
flag saying my data is returned as xxx and just call Encode::decode with 
xxx (then eventually I could drop odbc_utf8_on).

However, Encode::decode converts a scalar returning a new scalar (not 
converted in place). Just wondered if anyone else has had to do this. 
I've never called a module method from XS so I got some pointers at which are useful but I'm still 
wondering how anyone else has solved this before I try and implement 



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About