How many characters can be stored in 4KB?

后端 未结 3 968
孤街浪徒
孤街浪徒 2020-12-08 03:52

How many characters can i store in 4kb when the characters are in utf-8 encoding ?

3条回答
  •  余生分开走
    2020-12-08 04:20

    In UTF-8 characters need between 1 and 4 bytes. So, you can store between 4096 and 1024, respectively, UTF-8 characters in 4KB.

    I would assume that in many use cases you can expect that most characters fit into one byte and almost all into 2.

提交回复
热议问题