Fix some character sets detection (#1490135)