3 class EncodingConverter
{
8 function __construct($in_encoding, $out_encoding) {
9 $this->in_encoding
= $in_encoding;
10 $this->out_encoding
= $out_encoding;
13 function handleError($err, $msg) {
14 $this->last_error
= $msg;
17 function convert($str) {
18 $this->last_error
= FALSE;
20 set_error_handler(array(&$this, 'handleError'));
21 $ret = iconv($this->in_encoding
, $this->out_encoding
, $str);
22 restore_error_handler();
27 function getLastError() {
28 return $this->last_error
;