当前位置: 首页>>代码示例>>PHP>>正文


PHP Encoding::toUtf8方法代码示例

本文整理汇总了PHP中Encoding::toUtf8方法的典型用法代码示例。如果您正苦于以下问题:PHP Encoding::toUtf8方法的具体用法?PHP Encoding::toUtf8怎么用?PHP Encoding::toUtf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Encoding的用法示例。


在下文中一共展示了Encoding::toUtf8方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($sqlQuery, $sqlParams)
 {
     if (empty($sqlQuery)) {
         throw new \InvalidArgumentException("sqlQuery should not be empty");
     }
     if (!is_array($sqlParams)) {
         throw new \InvalidArgumentException("sqlParams should be an array");
     }
     $this->sqlQuery = $sqlQuery;
     $this->sqlParams = Encoding::toUtf8($sqlParams);
     return $this->prepareAndRun();
 }
开发者ID:no-chris,项目名称:connector,代码行数:12,代码来源:Db.php

示例2: getAll

 public function getAll()
 {
     $this->csvArray = array();
     $isHeaderLine = true;
     while (($csvLine = fgets($this->csvFile)) !== false) {
         $csvLineArray = $this->splitCsvLine($csvLine);
         if ($isHeaderLine) {
             $this->setColumnsNames($csvLineArray);
             $isHeaderLine = false;
         } else {
             $this->csvArray[] = $this->mapCsvLineToObject($csvLineArray);
         }
     }
     fclose($this->csvFile);
     return Encoding::toUtf8($this->csvArray);
 }
开发者ID:no-chris,项目名称:connector,代码行数:16,代码来源:CsvFile.php

示例3: testEncodeComplexItemToUtf8

 public function testEncodeComplexItemToUtf8()
 {
     $latin1 = new \stdClass();
     $latin1->n1 = new \stdClass();
     $latin1->n = $this->iso88591;
     $latin1->n1->n2 = $this->iso88591;
     $latin1->a1 = array($this->iso88591, $this->iso88591, "a2" => array($this->iso88591, $this->iso88591), "o" => $latin1->n1);
     $utf8 = Encoding::toUtf8($latin1);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->n);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->n1->n2);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->a1[0]);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->a1[1]);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->a1["a2"][0]);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->a1["a2"][1]);
     $this->assertEquals(Encoding::toUtf8($this->iso88591), $utf8->a1["o"]->n2);
 }
开发者ID:no-chris,项目名称:connector,代码行数:16,代码来源:EncodingTest.php

示例4: testUtf8InsertionIsNotDoubleEncoded

 public function testUtf8InsertionIsNotDoubleEncoded()
 {
     $stringUtf8 = "des accents en \"utf-8\" : éèàù & Straße";
     $columnsToValues = array("intcol" => 7, "utf8col" => Encoding::toUtf8($stringUtf8));
     $insertId = $this->db->insert($this->testsTable, $columnsToValues);
     $getOneRowSql = "SELECT * FROM {$this->testsTable} WHERE `id` = :id";
     $sqlParams = array("id" => $insertId);
     $row = $this->db->getOneRow($getOneRowSql, $sqlParams);
     $this->assertEquals($stringUtf8, $row->utf8col);
 }
开发者ID:no-chris,项目名称:connector,代码行数:10,代码来源:DbTest.php

示例5: testIsLatin1FileReadAsUtf8

 public function testIsLatin1FileReadAsUtf8()
 {
     $this->csvFile = new CsvFile(__DIR__ . '/Data/iso88591.csv', "\t");
     $csvContent = $this->csvFile->getAll();
     $this->assertEquals(Encoding::toUtf8("CD-R 52x certifié, 25 pièces en cake box"), $csvContent[0]->ProductName);
 }
开发者ID:no-chris,项目名称:connector,代码行数:6,代码来源:CsvFileTest.php


注:本文中的Encoding::toUtf8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。