Improved UTF-8 support

1. Added JSON and fixed UTF-8 support (it was required)
2. Changed all samples and tests to UTF-8
3. Improved detection algorithm
4. Changed to 300 bytes to get better results (rather than 200 bytes)