Skip to content
Snippets Groups Projects
Commit 8f913c0e authored by Laurent's avatar Laurent
Browse files

hotline #80953 utf8 encode data only on non-unicode files

parent 5e4734fe
Branches
Tags
4 merge requests!2870Hotline,!2869Master,!2855Hotline#80953 story nanook 41 caracteres accentues etalon,!2854Hotline#80953 story nanook 41 caracteres accentues etalon
......@@ -82,8 +82,10 @@ abstract class Class_Cosmogramme_Generator_AbstractTask {
protected function _extract($data) {
$data = utf8_encode($data);
return explode('|', $data);
return explode('|',
mb_detect_encoding($data, 'UTF-8', true)
? $data
: utf8_encode($data));
}
......
......@@ -348,7 +348,9 @@ class PhasePrepareIntegrationsNanookStandardTest
->whenCalled('getLibrariesOf')->with('foo')
->answers(['BIB_SPS_UTT|ID_SITE|LIBELLE',
'2|My library'])
'2|Ma library',
'6|Ma bibliothèque',
'8|' . iconv('UTF-8', 'ISO-8859-1', 'Ma médiathèque')])
->whenCalled('getSectionsOf')->with('foo')
->answers(['BIB_C_SECTION|CODE|LIBELLE',
......@@ -624,6 +626,18 @@ class PhasePrepareIntegrationsNanookStandardTest
}
/** @test */
public function libraryIdSixLabelShouldBeMaBibliothèque() {
$this->assertEquals('Ma bibliothèque', Class_Cosmogramme_Generator_FixedIdBib::find(6)->getLibelle());
}
/** @test */
public function libraryIdEigthLabelShouldBeMaMédiathèque() {
$this->assertEquals('Ma médiathèque', Class_Cosmogramme_Generator_FixedIdBib::find(8)->getLibelle());
}
/** @test */
public function plannedIntegrationsOfRemovedLibraryShouldBeDeleted() {
$this->assertEmpty(Class_IntMajAuto::findAllBy(['id_bib' => 3]));
......
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