character encoding - Has PHP's behaviour changed? -
studying zend-ce exam, came across question:
given php.ini setting of:
default_charset = utf-8
following code print in browser?<?php header('content-type: text/html; charset=iso-8859-1'); echo '✂✔✝'; ?>
a. garbled data
b. & # 9986 ; & # 10004 ; & # 10013 ;
c. blank line due charset mismatch
the expected answer c, expected - , when ran code, got garbled data (answer a)! wonder if phps behaviour had been changed or if error in test?
i not aware php behaviour has changed in respect. however, html standard has changed.
prior html 4, numeric character references such ✂
interpreted respect document character set (which specified in content type header field). reasonable that, code point 9986 not exist in iso 8859-1, nothing printed.
since html 4, numeric character references interpreted unicode code points. echo '✂✔✝';
should print ✂✔✝
regardless of content type header field says character set. reasonable call ✂✔✝
garbled data, if 1 not familiar unicode dingbats block.
Comments
Post a Comment