javadataweavemule-el

Add BOM in the beginning of a String


I have exposed a GET in an API which returns an application/csv back to the caller. NB: the resulting application/csv is just a string. The caller wants the result to include a BOM.

This is how I set the contents of the returned application/csv with MEL:

#[flowVars.csvFile]

I am trying to add the BOM with a simple concatenation, but it doesnt work.

How should I add the BOM in the beginning of a String?

If it cannot be done with MEL, is there a way with dataweave or java/groovy?


Solution

  • It turns out Postman do not show the BOM. Otherwise the linked solution works perfectly.