setEscapeUnicode() публичный Метод

If true, unicode characters will be escaped as hexadecimals strings. For example, "ü" will be escaped as "\u00fc". By default, unicode characters are escaped.
public setEscapeUnicode ( boolean $enabled )
$enabled boolean Whether unicode characters should be escaped
Пример #1
0
 public function testUnicodeNotEscaped()
 {
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         $this->markTestSkipped('PHP >= 5.4.0 only');
         return;
     }
     $this->encoder->setEscapeUnicode(false);
     $this->assertSame('"ü"', $this->encoder->encode('ü'));
 }
Пример #2
0
 public function __construct($path, $flags = 0)
 {
     Assert::string($path, 'The path must be a string. Got: %s');
     Assert::notEmpty($path, 'The path must not be empty.');
     Assert::integer($flags, 'The flags must be an integer. Got: %s');
     $this->path = $path;
     $this->flags = $flags;
     $this->encoder = new JsonEncoder();
     $this->encoder->setEscapeGtLt($this->flags & self::ESCAPE_GT_LT);
     $this->encoder->setEscapeAmpersand($this->flags & self::ESCAPE_AMPERSAND);
     $this->encoder->setEscapeSingleQuote($this->flags & self::ESCAPE_SINGLE_QUOTE);
     $this->encoder->setEscapeDoubleQuote($this->flags & self::ESCAPE_DOUBLE_QUOTE);
     $this->encoder->setEscapeSlash(!($this->flags & self::NO_ESCAPE_SLASH));
     $this->encoder->setEscapeUnicode(!($this->flags & self::NO_ESCAPE_UNICODE));
     $this->encoder->setPrettyPrinting($this->flags & self::PRETTY_PRINT);
     $this->encoder->setTerminateWithLineFeed($this->flags & self::TERMINATE_WITH_LINE_FEED);
     $this->decoder = new JsonDecoder();
     $this->decoder->setObjectDecoding(JsonDecoder::ASSOC_ARRAY);
 }