Calculate string length by bytes

“中文”.length in javascript will return 2 which is not the result I want, here is the replacement:

byteLength(‘中文’); will return 6.

Reference: