I work on Windows 7, with phpunit & selenium & Firefox.
I have this code:
$value1 = $this->getText("//div[@id= bla bla");
$this->assertEquals($value1, "\u20AC 1,12");
where \u20AC
should be the Euro sign. I've also tried €
, €
, €
, but phpunit keeps giving an error, expecting some impossible character combination.
Printing $value1
gives me the same weird combination.
Anybody knows of a way to use, check on HTML special characters or which charset I should/could use?
PHP doesn't support the \u
escape you're trying to use, so that's why that's not working.
One approach would be to use:
$euro = html_entity_decode('€');
$this->assertEquals($value1, "$euro 1,12");
Note, the above is kind of nice for readability purposes, although it's verbose and inefficient.
Other than that, you pretty much have to work out the raw UTF byte sequence, and use one \x escape per byte. For example, the UTF8 byte sequence for U+2022 can be represented in PHP as "\xE2\x80\xA2"
. I believe the euro sign would be "\xE2\x82\xAC"