in reply to Yet another Encoding issue...

Glad this is solved! A great way to think/talk about this issue that helped me understand it is to differentiate between "characters" and "bytes". Then:
$bytes = encode($characters); $characters = decode($bytes);
where "characters" are the conceptual thing to be represented, and "bytes" is the means the computer (and hard disk etc) use to do the representing.