web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

how to convert utf8 bom to utf8 format in business central?

(0) ShareShare
ReportReport
Posted on by 13

Hi,

I am trying to convert UTF-8 BOM to UTF-8 format in Business Central using XMLport object in AL but am unable to do so. I have already used the TextEncoding property in XMLport, but it takes the UTF-8 BOM format by default. Any suggestions for getting from UTF-8 BOM to UTF-8 format?

I am running my XMLport in the code below.

local procedure Export_File()

var

TempBlob: Codeunit "Temp Blob";

CustomBalance: XmlPort Balance;

OutStreamStr: OutStream;

begin

TempBlob.CreateOutStream(OutStreamStr);

CustomBalance.SetDestination(OutStreamStr);

CustomBalance.InitializeRequest(0D, EndDate);

if CustomBalance.Export() then begin

ExportBlobList.Add(TempBlob);

ExportFileNames.Add(CustomBalance.Filename());

end;

end;

I have the same question (0)
  • Ramiz Profile Picture
    597 on at
    Hi,

    Try adding the TextEncoding in CreateOutStream.
     
    TempBlob.CreateOutStream(OutStreamStr, TextEncoding::UTF8);
     
  • Suggested answer
    Gani.A Profile Picture
    13 on at
    Hi Ramiz,
     
    I also tried using CreateOutStream(), but still the same output.
     
    TempBlob.CreateOutStream(OutStreamStr, TextEncoding::UTF8);
  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at
    Hi,
     
    I am confused are you saying BLOB instead of BOM?
     
  • Suggested answer
    Gani.A Profile Picture
    13 on at
     
    It is UTF-8-BOM, the encoding of the file is UTF-8 BOM although the TextEncoding property is set to UTF-8. I also tried
    CurrXMLport.TextEncoding(TextEncoding::UTF-8) and this also failed to get UTF-8.
     
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,431 Super User 2025 Season 2 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,064

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,568 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,063 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans