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...
Answered

Thousand seperator problem while writing to .txt file

(3) ShareShare
ReportReport
Posted on by 64
Hello, 
I have a problem while displaying a txt file after inserting into it which is the thousand seperator is displayed as '?' 
for exemple if the number is '3123,123' it's shown '3?123,123' 
 
can anyone help ? 
Thanks in advance
 
this is my code : 
    procedure WritetoExcel(vExportSageT: Record "TExport Sage")
    var
        TempBlob: Codeunit "Temp Blob";
        OutStream: OutStream;
        InStream: InStream;
        FileName: Text;
        Line: Text;
        FileMgmt: Codeunit "File Management";
        RecZenSetup: Record "ZEN Setup";
        RecGenLedgSetup: Record "General Ledger Setup";
        CRLF: Text[2];
        AmountText: Text;
    begin
        if RecZenSetup.Get() then;
        if RecGenLedgSetup.Get() then;
        FileName := 'Interface Sage X3.txt';
        CRLF[1] := 13;
        CRLF[2] := 10;
        TempBlob.CreateOutStream(OutStream);
        if vExportSageT.FindSet() then
            repeat
                AmountText := Format(vExportSageT.Amount);
                AmountText := AmountText.Replace(' ', '');
                Message('%1', Format(vExportSageT.Amount));
                //AmountText := DelChr(AmountText, ' ', ',');
                Line := vExportSageT.Ref + ';' + vExportSageT."Ticket No" + ';' + vExportSageT."Store No" + ';'
                + vExportSageT.Type + ';' + RecZenSetup."Client Code" + ';' + RecGenLedgSetup."LCY Code" + ';'
                + Format(RecZenSetup."Timbre Fiscal") + ';' + Format(vExportSageT.Amount) + ';' + Format(vExportSageT.Date) + ';'
                + vExportSageT."Item Code" + ';' + RecZenSetup.UV + ';' + '1;' + RecZenSetup.NTaxe + ';' + Format(vExportSageT.Amount) + ';' + vExportSageT."Payment Method";
                OutStream.WriteText(Line + CRLF);
            until vExportSageT.Next() = 0;
 
        TempBlob.CreateInStream(InStream);
 
        FileName := 'ExportedData.txt';
        DownloadFromStream(InStream, '', '', '', FileName);
 
    end;
I have the same question (0)
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    26,447 Super User 2025 Season 2 on at
     
    This issue is typically related to encoding or locale/format settings during the file generation process.
     
    TextEncoding::UTF8 ensures special characters (like non-breaking space or locale-specific separators) are preserved correctly.
     
    Try this : 
     
    TempBlob.CreateOutStream(OutStream, TextEncoding::UTF8);
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    YUN ZHU Profile Picture
    95,750 Super User 2025 Season 2 on at
    Hi, hope the following can give you some hints.
     
    Thanks.
    ZHU

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 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans