/** * Tests UTF-8 fixing. */ public function testFixUtf() { $this->assertEquals('žluťoučký kůň pěl ďábelské ódy', Charset::fixUtf('žluťoučký kůň pěl ďábelské ódy')); $this->assertEquals('Государственный гимн Российской Федерации', Charset::fixUtf('Государственный гимн Российской Федерации')); $this->assertEquals('', Charset::fixUtf(file_get_contents(DIR_FILES . '/charset/cp1250.txt'))); $this->assertEquals('', Charset::fixUtf(file_get_contents(DIR_FILES . '/charset/iso-8859-2.txt'))); }
/** * Tests UTF-8 fixing. */ public function testFixUtf() { $this->assertEquals('žluťoučký kůň pěl ďábelské ódy', Charset::fixUtf('žluťoučký kůň pěl ďábelské ódy')); $this->assertEquals('Государственный гимн Российской Федерации', Charset::fixUtf('Государственный гимн Российской Федерации')); $expected = 'glibc' === ICONV_IMPL ? '' : 'luouk k pern pl belsk '; $this->assertEquals($expected, Charset::fixUtf(file_get_contents(DIR_FILES . '/charset/cp1250.txt'))); $this->assertEquals($expected, Charset::fixUtf(file_get_contents(DIR_FILES . '/charset/iso-8859-2.txt'))); }
/** * Sends a trace. * * @param string $message Message text * @param string $file File name * @param integer $line File line * @param array $trace Trace * @return boolean */ public static function trace($message, $file, $line, array $trace) { $output = array(array('Type' => self::TRACE, 'Label' => null), array('Message' => Charset::fixUtf($message), 'File' => $file, 'Line' => $line, 'Trace' => self::replaceVariable($trace))); return self::send($output); }
/** * Sends a trace. * * @param string $message Message text * @param string $file File name * @param integer $line File line * @param array $trace Trace * @return boolean */ public static function trace(string $message, string $file, int $line, array $trace) : bool { $output = [['Type' => self::TRACE, 'Label' => null], ['Message' => Charset::fixUtf($message), 'File' => $file, 'Line' => $line, 'Trace' => self::replaceVariable($trace)]]; return self::send($output); }