encoding() 공개 메소드

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 encoding ( string $charset ) : boolean
$charset string
리턴 boolean Returns `false` if `stream_encoding()` function does not exist, boolean result of `stream_encoding()` otherwise.
예제 #1
0
 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));
 }
예제 #2
0
 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);
 }