Sets the character set for stream encoding if possible. The stream_encoding
function is not guaranteed to be available as it is seems as if it's experimental
or just not officially documented. If the function is not available returns false.
public function testEncoding() { $stream = new Stream($this->_testConfig); $result = $stream->open(); $stream->encoding('UTF-8'); $result = $stream->resource(); $this->assertTrue(is_resource($result)); $stream = new Stream($this->_testConfig + array('encoding' => 'UTF-8')); $result = $stream->open(); $result = $stream->resource(); $this->assertTrue(is_resource($result)); }
public function testEncoding() { $stream = new Stream($this->_testConfig); $result = $stream->open(); $stream->encoding('UTF-8'); $result = $stream->resource(); $this->assertInternalType('resource', $result); $stream = new Stream($this->_testConfig + array('encoding' => 'UTF-8')); $result = $stream->open(); $result = $stream->resource(); $this->assertInternalType('resource', $result); }