Maybe the own browser could make it the dirty work for us?.
Maybe the source code in C of this function could be used as a template if a full TCL implementation is needed?.
Just thinking :)