adding some strings
[moodle-linuxchix.git] / search / Zend / Search / Lucene / EncodingConverter.php
blob9c22e5cd73a28303e833cea1debd41f2c05aab2d
1 <?php
3 class EncodingConverter {
4 private $last_error,
5 $in_encoding,
6 $out_encoding;
8 function __construct($in_encoding, $out_encoding) {
9 $this->in_encoding = $in_encoding;
10 $this->out_encoding = $out_encoding;
11 } //constructor
13 function handleError($err, $msg) {
14 $this->last_error = $msg;
15 } //handleError
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();
24 return $ret;
25 } //convert
27 function getLastError() {
28 return $this->last_error;
29 } //getLastError
30 } //EncodingConverter