at all times text encoded in UTF-8 will never give us more than a +50% file size of the same text encoded in UTF-16. true / false?

后端 未结 4 1455
攒了一身酷
攒了一身酷 2021-02-06 15:41

Somewhere I read (rephrased):

If we compare a UTF-8 encoded file VS a UTF-16 encoded file, At some times, the UTF-8 file may give a 50% to 100% larger fil

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 16:25

    If you have one byte for the character and add on a second byte, I'd call that a 100% increase, not 50%. I think that's what the author means.

    If I write X characters with N bytes/character to a file I'll have NX bytes in that file. So you can see where doubling or tripling the number of bytes per character will have a linear effect on the size of the file.

提交回复
热议问题