Closed xxchan closed 2 years ago
Chinese characters count correctly for me though. In your screenshot, it indicates 2 as well?
Sorry if that was unclear. I mean 中文
should be 4 letters. One Chinese character takes 2 letters.
I did some experiments on Twitter and I guess UTF8 1&2bytes (e.g., ascii, ߷
) characters are counted as 1 letter, and 3&4bytes (e.g., 啊
, 𒀐
) characters are counted as 2 letters...
If so, const blockLen = [...blockContent].map(c=>Math.floor((Buffer.byteLength(c, 'utf8')+1)/2)).reduce((a, b) => a + b, 0)
may work
I see! It looks like their API documentation does cover this.
Will find some time to fix this in the coming week.
Fixed in v1.9.0!
It should be 2