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;

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    9,638 Super User 2025 Season 1 on at
  • Suggested answer
    Gani.A Profile Picture
    13 on at
    how to convert utf8 bom to utf8 format in business central?
     
    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
    Saurav.Dhyani Profile Picture
    14,312 Super User 2025 Season 1 on at
    how to convert utf8 bom to utf8 format in business central?
    Hi,
     
    I am confused are you saying BLOB instead of BOM?
     
  • Suggested answer
    Gani.A Profile Picture
    13 on at
    how to convert utf8 bom to utf8 format in business central?
    Hi Ramiz,
     
    I also tried using CreateOutStream(), but still the same output.
     
    TempBlob.CreateOutStream(OutStreamStr, TextEncoding::UTF8);
  • Ramiz Profile Picture
    538 on at
    how to convert utf8 bom to utf8 format in business central?
    Hi,

    Try adding the TextEncoding in CreateOutStream.
     
    TempBlob.CreateOutStream(OutStreamStr, TextEncoding::UTF8);
     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,150 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,895 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans