What does utf- 8 do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What does utf- 8 do?

25th Mar 2017, 4:07 AM
Pawan Ale
2 Answers
+ 5
Because you've already been told what it is, I'll tell you why it's important: It affects the representation of the string in memory. If you're converting raw bytes into a string, you'll you need to know the original encoding in order to get the original string back. Also, because it supports multi-byte characters, it can represent more than plain old ASCII can. If you're dealing with text from languages that don't use the Latin alphabet (or use combining characters) you'll want to use UTF-8.
25th Mar 2017, 4:19 AM
Squidy
Squidy - avatar
+ 4
UTF-8 is a compromise character encoding that can be as compact as ASCII (if the file is just plain English text) but can also contain any unicode characters (with some increase in file size). UTF stands for Unicode Transformation Format. The '8' means it uses 8-bit blocks to represent a character.
25th Mar 2017, 4:11 AM
Garvit Joshi
Garvit Joshi - avatar