added generate_charset method