Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: DBI Adding Null Bytes to String

by afoken (Chancellor)
on May 25, 2016 at 22:16 UTC ( [id://1164146]=note: print w/replies, xml ) Need Help??


in reply to DBI Adding Null Bytes to String

When I set the 'LongTruncOk' parameter to true for a database handle and retrieve a long string it seems to insert null bytes between each character. For example, a string of '600' comes back as (in hex): 36 00 30 00 30

Looks like UTF-16.

I'm working with an MS SQL Server if it matters.

Yes, it does. Please show us the definition of the table you are reading from. Are you reading from an NVARCHAR (as opposed to a VARCHAR)?

Could you try running the tests 40UnicodeRoundTrip.t, 41Unicode.t, and perhaps also 45_unicode_varchar.t from DBD::ODBC? (You will also need UChelp.pm from the same directory.)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164146]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found