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

(2) ShareShare
ReportReport
Posted on by 30
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;
  • Suggested answer
    YUN ZHU Profile Picture
    85,503 Super User 2025 Season 1 on at
    Thousand seperator problem while writing to .txt file
    Hi, hope the following can give you some hints.
     
    Thanks.
    ZHU
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    24,296 Super User 2025 Season 1 on at
    Thousand seperator problem while writing to .txt file
     
    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

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans