I'm using some code to convert ISO-8859 string to utf8. Then I want to assert, that it has been converted correctly. The code is:
class EncodingTest extends TestCase {
public function testImapUtf8()
{
$pairs = [
['=?ISO-8859-13?Q?Darba_s=E2k=F0ana_ar_Gmail?=', 'Darba sākšana ar Gmail'],
['Normal text', 'Normal text'],
['Darba sākšana ar Gmail', 'Darba sākšana ar Gmail'],
];
foreach ($pairs as $pair) {
$this->assertEquals(($pair[1]), (imap_utf8($pair[0])));
}
}
}
However, for the first pair, it gives me an error:
1) EncodingTest::testImapUtf8
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Darba sākšana ar Gmail'
+'Darba sākšana ar Gmail'
The strings look the same. I guest there are some invisible characters. how do I test that imap_utf8
works as expected?
Aucun commentaire:
Enregistrer un commentaire