The MDN Web Docs offer a solution, which passes by first encoding the string with TextEncoder (and later using the TextDecoder counterpart to reverse it), which is what this PR implements.
I've created a separate util (utils/url-param.js) exclusive for this processing, with comments so that future developers are aware of this issue. I've chosen not to add these methods to utils/url.js as that file contains extra processing, including functions to remap legacy datasets, and I feel like the objective of these new very specific functions would not be clear.
Overview
The FE makes use of btoa() to Base64 encode parameters for the URL. However, this method fails when strings include characters that take more than one byte, which is the case of "Bình Thuận", the string that when searched caused the FE to crash.
This is known as the Unicode Problem.
The MDN Web Docs offer a solution, which passes by first encoding the string with TextEncoder (and later using the TextDecoder counterpart to reverse it), which is what this PR implements.
I've created a separate util (
utils/url-param.js
) exclusive for this processing, with comments so that future developers are aware of this issue. I've chosen not to add these methods toutils/url.js
as that file contains extra processing, including functions to remap legacy datasets, and I feel like the objective of these new very specific functions would not be clear.Testing
Tracking
FLAG-923