1--TEST--
2Basic UConverter::convert() w/ Subsitution
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--INI--
6intl.use_exceptions=false
7--FILE--
8<?php
9foreach(array('?','','??') as $subst) {
10  $opts = array('to_subst' => $subst);
11  $ret = UConverter::transcode("This is an ascii string", 'ascii', 'utf-8', $opts);
12  if ($ret === FALSE) {
13    echo "Error: ", intl_get_error_message(), "\n";
14  } else {
15    var_dump($ret);
16  }
17  $ret = UConverter::transcode("Snowman: (\xE2\x98\x83)", 'ascii', 'utf-8', $opts);
18  if ($ret === FALSE) {
19    echo "Error: ", intl_get_error_message(), "\n";
20  } else {
21    var_dump($ret);
22  }
23}
24--EXPECTF--
25string(23) "This is an ascii string"
26string(12) "Snowman: (?)"
27Error: transcode() returned error 1: U_ILLEGAL_ARGUMENT_ERROR: U_ILLEGAL_ARGUMENT_ERROR
28Error: transcode() returned error 1: U_ILLEGAL_ARGUMENT_ERROR: U_ILLEGAL_ARGUMENT_ERROR
29Error: transcode() returned error 1: U_ILLEGAL_ARGUMENT_ERROR: U_ILLEGAL_ARGUMENT_ERROR
30Error: transcode() returned error 1: U_ILLEGAL_ARGUMENT_ERROR: U_ILLEGAL_ARGUMENT_ERROR
31