charset: move encoding-specific setup code to include