Encoding/decoding

Dave Hodgkinson davehodg at gmail.com
Thu Apr 1 03:30:01 BST 2010


On 1 Apr 2010, at 00:50, Jurgen Pletinckx wrote:
> 
> Thanks, I feel positively enlightened! Of course, I would still like all
> that text to use a single encoding. "How hard could it be?"

Quite hard.

First, you have to ensure that the data you get in is properly encoded.
With recent DBD::mysql (>= 5.x) you can tell it to do that when you 
connect or with an old version you can send a command to the server 
to do it. With data from elsewhere you need to decode_utf8 to convert
an octet stream into internal utf8. is_utf8 is handy here. 

On output, just make sure you tell everyone it's utf8, as you appear
to be attempting.

-- 
Dave Hodgkinson                                MSN: davehodg at hotmail.com
Site: http://www.davehodgkinson.com                  UK: +44 7768 490620
Blog: http://www.davehodgkinson.com/blog
Photos: http://www.flickr.com/photos/davehodg










More information about the london.pm mailing list