我需要计算使用 javascript 进行 UTF8 编码时 textarea 的字节数。知道我会怎么做吗?
谢谢!
最佳答案
encodeURIComponent(text).replace(/%[A-F\d]{2}/g, 'U').length
关于javascript - 使用javascript计算textarea中的字节数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2848462/