Improvements to character set detection strategy. Bugfix for WhenAll