in reply to Encoding issues

1) If I want use a different encoding, this new encoding will have assigned different bits to each character than UTF-8 encoding. How can I apply this new encoding with input device (keyboard) as keyboard is already typing according to UTF-8 ?

Encode::from_to can translate UTF-8 into other encodings.

Secondly, if I want to type Hindi characters using different character encoding, how can I do that if I don't have Hindi keyboard ?

Producing Hindi characters is a question the input method that your operating system (or editor, or terminal, or whatever) offer, and usually not tied to a particular encoding.

You would do well to read up about the different subsytems that are involved (the operating system's input methods, key codes, character encodings), because you seem to mix them up right now.