Convert PHP serialized arrays to json & fix UTF-8 languages detection

As I've tried to detect russian language, it failed. Removed serialized arrays and also removed _next_char PHP based implementation, as its not needed in JS.
Also added string cleaning before processing.

More work to be done :)

I've fixed tests in .js file only, as I do not see any need in CS here..