Internationalization and localization tools


Locale-Sensitive JavaScript NodeJS Method

Buffer.byteLength(string[, encoding]);

Internationalization (I18n) Method Overview

The Buffer.byteLength returns the actual byte length of a string (not the number of characters).

For example:

const str = '\u00bd + \u00bc = \u00be';

console.log(`${str}: ${str.length} characters, ${Buffer.byteLength(str, 'utf8')} bytes`);

// ½ + ¼ = ¾: 9 characters, 12 bytes

Click here for additional details.

I18n Issues

Buffer.byteLength must be passed the correct encoding for its input.

Suggested Replacement

Double check to ensure that the encoding is set to the correct value.

Globalyzer will detect this method and report it as an i18n issue. If you have determined that the call is being handled correctly, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.



Locale-Sensitive JavaScript Methods

 

Lingoport internationalization and localization services and software