Treegroup not working if category field contains apostrophes

I was trying treegroup connector.
My category field contains values with apostrophes, and I noticed that the treegroup connector renders malformed xml in such a case, and on client side the browser cannot load the data.

<?xml version='1.0' encoding='utf-8' ?><tree id='0'><item id='Corte d'Appello di Ancona__{group_param}' text='Corte d&apos;Appello di Ancona' ...

The text attribute is correctly formatted, while id is not
I am not so confident with dhtmlx code, so I do not know how to correct it

Please try to update tree_connector.php with the attached file, it must resolve the issue.
tree_connector.zip (2.07 KB)

It works, thanks!