Skip to content
Documentation
Updated 2 minutes to read
Markdown

The removebom Formula function returns the content without a leading byte order mark (BOM).

Compare the length of decoded base64 text with and without removebom in the Test Expression tab, animated walkthrough (7.12)
Animated walkthrough: on the base64 body from Example 1, length(base64decode(body)) returns 12, the 11 characters of test åäöÅÄÖ plus the invisible BOM, and length(removebom(base64decode(body))) returns 11.

removebom(content)
Parameter Required Description
content Yes The text to clean: body, context, or the result of another function.

The content with a leading BOM removed from each value. Content without a BOM is returned unchanged.

A UTF-8 BOM is the bytes EF BB BF at the start of a file or message (see With BOM vs without BOM). It's invisible in most editors, but it is still a character, and it can sit at the start of base64 text that you decode with base64decode.

Example 1: Remove the BOM from decoded base64 content

Section titled “Example 1: Remove the BOM from decoded base64 content”

The Log API takes the message body base64-encoded. To log a body that is itself the base64 text 77u/dGVzdCDDpcOkw7bDhcOEw5Y=, you send it encoded once more:

Nzd1L2RHVnpkQ0REcGNPa3c3YkRoY09FdzVZPQ==

The logged body, shown on the Message Body tab and read as UTF-8, is:

77u/dGVzdCDDpcOkw7bDhcOEw5Y=

base64decode(body) turns this into the bytes EF BB BF (a UTF-8 BOM) followed by test åäöÅÄÖ. The BOM stays in the result as an invisible first character.

Compare the length of the decoded text with and without removebom, using length:

Formula Result Screenshot
length(base64decode(body)) 12 Test Expression tab: length(base64decode(body)) returns 12 for the decoded text with a BOM (7.12)
length(removebom(base64decode(body))) 11 Test Expression tab: length(removebom(base64decode(body))) returns 11 once the BOM is removed (7.12)

test åäöÅÄÖ is 11 characters; the extra character in the first result is the BOM, which removebom strips.

The same applies to any content that holds base64 text starting with a BOM, for example a JSON property value read with jsonPath: removebom(base64decode(jsonPath('Payload', body))).

  • Only a BOM at the start of each value is removed. To change characters elsewhere in the text, use replace or replaceregex.
  • A message body read with a without BOM Character Encoding, such as UTF-8 (without BOM), already has its BOM removed before the formula runs; removebom matters for BOMs inside decoded or embedded content.

...

Version:
Release date: N/A
Loading...

Explore Nodinite for 30 days – completely free

  • Find out why this is the leading O&M software
  • Prove your business case
  • Test the self-service for the business side

Loading...

See how Nodinite resolves your technical issues, in a LIVE Demo!

Once you submit this request:

  • We will give you a short call to understand the issues you want to tackle.
  • Understand solutions you have tried and why were you not happy with them.
  • Book a convenient slot for a LIVE demo!

Loading...