Convert encoding of all values inside an array before json_serialize

This should fix the encoding problems with issue 524. 

`TJavaScript::jsonEncode` now handles nested arrays by unpacking them, converting the strings to UTF-8 and repacking them. 
Of course this may have a performance impact depending on the size.

I'm not saying that this is the only way to fix this issue nor the best way, but at least it will fix the issue 524 in a generic way.