Problem with escaping CDATA closing tag

I know there is a very slim chance of this ever causing a problem, however the chance is there that a user will include the closing CDATA tag characters (ie. ]]>) within their data, and because I enclose everything within a grid with CDATA tags, obviously this would cause a problem.

What I’ve tried to do is replace the closing tag and split it between two CDATA elements:
Original data:

Test ]]> 123

Becomes:

<![CDATA[Test ]]]]><![CDATA[>123]]>

Unfortunately this isn’t working. It isn’t causing a problem with the loading of the grid, but the cell doesn’t display the second CDATA element.

FYI: The way I load the grid is I have an ActiveX DLL return an XML string, which is then loaded with grid.parse.

Try to use escaping instead of CDATA.
http://docs.dhtmlx.com/doku.php?id=others:special_characters_in_xml