How to save an ANSI file from Business Central?

Hi experts,

This is regarding Business Central cloud.

When I make a file, I can set the encoding to Windows, UTF-8, UTF-16 and MSDOS.

Our customer need a file with ANSI encoding.

How do I do that?

Hope, you can help.

Morten

Answers

  • SanderDkSanderDk Member Posts: 504
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • MortenSteengaardMortenSteengaard Member Posts: 139
    Hi SanderDk,
    Thank you for your reply.
    You are right, but when I save the file on my local computer, open it in Notepad and select "Save as", then I can see that it is "UTF-8".
    The file must be imported into "EG Lønservice" and the letters æ, ø and å are not correct after the import.
    If I manually make a text file with ANSI encoding using Notepad, then it works fine.
    Best regards,
    Morten
  • vaprogvaprog Member Posts: 1,156
    So, how do you create the file? How do you tell the system to create the file with Windows encoding?
  • MortenSteengaardMortenSteengaard Member Posts: 139
    Hi vaprog,
    I have the data in a Temp Blob and save it to a file like this:

    TempBlob.CreateInStream(IStream, TEXTENCODING::Windows);
    //TempBlob.CreateInStream(IStream, TEXTENCODING::UTF8);
    //TempBlob.CreateInStream(IStream, TEXTENCODING::MSDos);

    Filename := 'Test.txt';
    DownloadFromStream(IStream, '', '', '', Filename);
  • vaprogvaprog Member Posts: 1,156
    I would expect what you do to work correctly. If it does not, I'd write to a tempfile, then download that tempfile. This way you can set the TEXTENCODING on the outstream.
Sign In or Register to comment.