4 psi.directory={PWD}/../../psi.d:{PWD}
12 function __construct($from, $to) {
13 if (!$this->cd = psi\iconv_open($to, $from)) {
14 throw new Exception(psi\strerror(psi\errno()));
18 function __destruct() {
19 psi\iconv_close($this->cd);
22 function update(string $data) : string {
23 if (0 > psi\iconv($this->cd, $data, $result)) {
24 throw new Exception(psi\strerror(psi\errno()));
30 $ic = new iconv_stream("utf8", "latin1");
32 foreach (["föö", "bää", "baßß"] as $str) {
33 var_dump(array_map("ord", str_split($ic->update($str))));
36 $bc = new iconv_stream("latin1", "utf8");
37 foreach (["föö", "bää", "baßß"] as $str) {
38 var_dump($bc->update($ic->update($str)));