When using large String values with AppendValue, an Overflow error is thrown. The problem is in the Escape method, that loops through the String using Integers. Changing the variable i from Integer to Long (line 547) and iLen from Integer to Long (line548) solved the problem.