When adding custom data-x attributes to any element, my understanding is that it's quite usual to use single quotes and to json encode the value because json_encoded data will have double quotes in it.

Code:

$html = '<a href="/">Bar</a>';
// I did add
// data-foo=\''.json_encode($foo_array).'\'
// to the above tag but code parser has stripped it out.

The form_open helper function accepts an array of key=>value pairs for adding attributes to the form tag. It double-quotes all values in the resulting string which breaks custom data attributes like this.

There is a workaround of passing a string instead of an array but that's clearly more cumbersome than using an array.

Is there any possibility or need to alter the helper function such that it either single-quotes data attributes or checks for quotes in the value and switches where necessary.