How do I decode HTML entities on a URL on table or any other widget?

To decode HTML entities on Appsmith from an URL or any data, you could use the following function:

export default {	 
 decodeHTMLEntities: (text) => {
	 var entities = {
  'amp': '&',
  'apos': '\'',
  '#x27': '\'',
  '#x2F': '/',
  '#39': '\'',
  '#47': '/',
  'lt': '<',
  'gt': '>',
  'nbsp': ' ',
  'quot': '"'
	 };
  return text.replace(/&([^;]+);/gm, function (match, entity) {
    return entities[entity] || match
  })
}
}

If you want to use this on any column for a table widget, you could use the following JS code on the computed value data property inside the column settings:

{{decodeURI(currentRow.column_name)}}

1 Like