Javascript controls for embeds: how to handle commas in value list

I’m trying to update a multi-select control with a text value that contains commas but it seems to not be handling the commas contained within the text value.

sigma_iframe?.contentWindow.postMessage(
{
  type: 'workbook:variables:update',
  variables: {
...
    'Property_param': 'ThingA,ThingB',
    'Income-Filter': '$75,000 to $99,999', 
},

This ends up producing an Income Filter list of ["$75", "000 to $99", "999"]
Is there some way to escape the comma so that I can include it as part of a value, rather than it being interpreted as a separator of values?

You can use url encodings here, e.g. for comma use %2C in place of the comma, so it would be:

  'Income-Filter': '$75%2C000 to $99%2C999',

More generally, you can call encodeURIComponent like so:

  'Income-Filter': encodeURIComponent('$75,000 to $99,999'),

From Tips and Tricks to Embedding