Hi all
I have an issue when writing a file. I try to write the file in textencoding::WINDOWS(Ansi), but end up having encoding "UCS-2 Little Endian" when I open the file in Notepad++
Here is my code:
LOCAL SaveToFilePath(FileContent : Text;RecordRef : RecordRef)
FieldRef := RecordRef.FIELD(3);
IF ISSERVICETIER THEN BEGIN
TempFile.CREATETEMPFILE(TEXTENCODING::Windows);
TempFile.CREATEINSTREAM(inStream);
Counter := 1;
REPEAT
Text := COPYSTR(FileContent, Counter,1);
TempFile.WRITE(Text);
Counter += 1;
UNTIL Counter > STRLEN(FileContent);
FileTo := FORMAT(FieldRef.VALUE)+'.txt';
FileName := FileTo;
// Tranfer the content from the temporary file on the NAV server to a file on the RoleTailored client.
DOWNLOADFROMSTREAM(
inStream,
'Save File to RoleTailored Client',
FileMgt.Magicpath,
'Text File *.txt| *.txt',
FileTo);
// Close the temporary file and delete it from NAV server.
TempFile.CLOSE();
END;
FileMgt.MoveFile(FileTo,ConsignorSetup."File Path"+FileName);
*This post is locked for comments