why we specified it while writing code
What is encoding
This is a very broad question but I’ll try my best to fit the answer here.
If you use anything other than the most basic English text, people may not be able to read the content you create unless you say what character encoding you used.
For example, you may intend the text to look like this:
but it may actually display like this when using using the wrong encoding:
All characters are stored in computers using a special code. A character encoding provides a key to unlock (ie. crack) the code. It is a set of mappings between the bytes in the computer and the characters in the character set. Without the key, the data looks like garbage.
Hence, it is a good practice to mention the encoding when dealing with textual data to avoid such issues.
Hope this helps!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.