Better way of getting locale's encoding