Để thoát dấu nháy đơn, dùng json_encode() để echo mảng trong HTML5 data attributes.
printf('<article data-tags="%s">', htmlspecialchars(json_encode(array('html5', ...)), ENT_QUOTES, 'UTF-8'));
Hoặc bạn cũng có thể dùng built-in
json_encode(array('html5', ...), JSON_HEX_APOS)