Reputation: 1029
I have a script like this:
document.getElementById('debugLayer').innerHTML = '<?php foreach (self::$errorLogs as $item) { echo htmlentities ($item, ENT_QUOTES).'<hr />'; } ?>';
where $errorLogs is an array of list. But it must have not escape correctly, since firefox say to this:
Error: malformed Unicode character escape sequence
Source File: X
Line: 553, Column: 63
Source Code:
document.getElementById('debugLayerDIVcontent_10').innerHTML = '<span style="background-color:yellow;"><i>Missing argument 3 for Upload::getDamagesStatisticsByUserID(), called in action_index.php on line 149 and defined</i></span>, in <span style="background-color:#40FF40;"><b>Upload.php</b></span> at <i><span style="background-color:red; color:white;">256</span></i> [<b>2</b>]<hr /><span style="background-color:yellow;"><i>Undefined variable: join</i></span>, in <span style="background-color:#40FF40;"><b>Upload.php</b></span> at <i><span style="background-color:red; color:white;">266</span></i> [<b>8</b>]<hr />';
what can be wrong?
Upvotes: 0
Views: 380
Reputation: 117354
htmlentities()
accepts a 3rd argument to define the used charset. The default is Latin1, set it to UTF-8 when you're using UTF-8
Upvotes: 1