Skip to content
Snippets Groups Projects
Commit 17c67fc3 authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #41044 : converter under tests, fix combined chars hex to string conversion

parent b076270b
Branches
No related merge requests found
......@@ -391,7 +391,7 @@ class Linse_Iso5426Converter {
$combined_chars = $c1 * 256 + $c2;
if (array_key_exists($combined_chars, $combined))
return chr($combined[$combined_chars]);
return html_entity_decode('&#'. $combined[$combined_chars] . ';', ENT_NOQUOTES, 'UTF-8');
$single = [0xe1 => 'Æ',
0xe2 => 'Đ',
......
<?php
/**
* Copyright (c) 2012-2016, Agence Française Informatique (AFI). All rights reserved.
*
* LINSE is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* LINSE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with LINSE; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Linse_Iso5426ConverterTest extends PHPUnit_Framework_TestCase{
/** @test */
public function shouldConvertEacute() {
$this->assertEquals('é', (new Linse_Iso5426Converter())->toUnicode(chr(0xc2).chr(0x65)));
}
}
\ No newline at end of file
......@@ -19,4 +19,5 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once __DIR__ . '/../Linse.php';
\ No newline at end of file
require_once __DIR__ . '/../Linse.php';
require_once __DIR__ . '/../Linse/Iso5426Converter.php';
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment