Internationalization and localization tools


Locale-Sensitive JavaScript Method

escape(string);

Internationalization (I18n) Method Overview

The escape method returns a copy of string with specific characters replaced by their hexadecimal encoded values. When the character is greater than %FF, a Unicode character encoding is used (e.g. %u6F22) and two Unicode character encoding values are used for characters outside the Basic Multilingual Plane (BMP) (e.g. %uD840%uDC10).

In the following example, the Chinese characters and spaces have been replaced with their hexadecimal encoded values:

var str = "漢One Two Three𠀐";
var result = escape(str);

Method returns:

result: %u6F22One%20Two%20Three%uD840%uDC10

Click here (w3schools) and here (MDN) for additional details.

Note: escape is no longer supported by Web Standards and should be replaced with encodeURI or encodeURIComponent.

I18n Issues

escape is deprecated and should no longer be called.

Suggested Replacement

escape is deprecated and should be replaced by calling either encodeURI or encodeURIComponent.


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