Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Database Problem

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

in reply to Database Problem

I think there are two separate places in the code path where encoding was wrong or transcoding got performed wrong. Once where you read the original content and stuffed it into Perl strings, and again when transforming that to printable output which introduced some extra '?' but otherwise kept the bytes the same.

You might try Code Page 936 or "GBK" for your original data, not UTF-8.

Again, printing the raw data you got from the source database as hex, with no further processing, would help. You can also print the raw bytes to a file, and try loading that file into a text editor with different encodings specified and see which one makes sense. You need to read Chinese to know when it "makes sense" though. Does 脭忙脛戮鹿碌 look like the correct content? It's all valid simplified Chinese characters, but it doesn't appear to make any sense out of context.