Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Database Problem

by John M. Dlugosz (Monsignor)
on May 20, 2011 at 13:31 UTC ( [id://905919] : note . print w/replies, xml ) Need Help??

in reply to Database Problem

Show the hex codes of the strings you are getting from the database. Then I might be able to identify the correct code page for you.

Or you can take a guess, perhaps Windows-1252 or whatever is normal for your part of the world. Use the Encoding module to process the string from the database.

Or maybe it is indeed UTF8 as you thought, but is coming through as individual bytes. The Encoding module will take care of that too: decode UTF8, rather than transferring the bytes directly to a Perl string. Just because it is UTF-8 data doesn't mean the string is "marked" properly by the database implementation; it could just be treating it as a string of individual bytes. Then Perl thinks it is a legacy 8-bit string and sees each byte of the multi-byte UTF-8 character as a separate character.