Thanks very much for your suggestion. That may be what I've been looking for, I'll try it out next time I'm working in that area.
Original Message:
Sent: 10-23-2024 10:33
From: Gianni Sandigliano
Subject: Converting Unix/Windows file line endings after fileload
Hi Rupert,
AFAIK $string() accepts as input decimal and hex numbers. See manual.
However I've never tried to do what you are trying to do...
Native line terminator for each platform was always acceptable in my cases.
Regards,
Gianni
------------------------------
Gianni Sandigliano
IT
Original Message:
Sent: 10-23-2024 09:37
From: Rupert Killik
Subject: Converting Unix/Windows file line endings after fileload
Hi Felix,
Thanks for your reply but I don't think this is what I'm looking for. The setting would determine what line endings were used when performing a filedump
to write a file, however, what I'm after is, after performing a fileload
of any file in a UNIX file system, where the line endings will be the UNIX "LF", I want to be able to convert them to "CRLF" in the payload I send back to the web browser via $webinfo("output")
.
The only way I've found to do this is to use the undocumented function $tometa, which isn't ideal, like this:
vFileContents = $replace(vFileContents, 1, $tometa(10), "%%$tometa(13)%%%%%$tometa(10)%%%", -1)
after loading the contents of the file into a variable.
So I guess the question has now developed to - does anyone know of a Uniface supported alternative to the undocumented (unsupported?) function $tometa
which can be used to reference the "LF" and "CR" characters in proc code?
Many thanks,
------------------------------
Rupert Killik
Senior Software Engineer
Rocket Forum Shared Account
Original Message:
Sent: 10-17-2024 03:16
From: FELIX HAZIZA
Subject: Converting Unix/Windows file line endings after fileload
Hello,
You have to specify in the [SETTINGS] section of the assignment file :
$NEW_LINE = CRLF
------------------------------
FELIX HAZIZA
CEO
Pacific Informatique
SAINT-DIDIER FR
Original Message:
Sent: 09-27-2024 06:26
From: Rupert Killik
Subject: Converting Unix/Windows file line endings after fileload
Hi,
I'm wondering if anyone has a good method of converting the line endings in a file read in with fileload from a Unix directory (LFs) to Windows line endings (CRLF), so that when the contents of the file are sent back to the client web browser for the user to download into their Windows downloads folder, the line endings are correct for Windows.
I've been looking at $encode and characters sets to see if there was anything specifically for this purpose but haven't found anything so far.
In the absence of that, I guess $replace will do the job, providing I can specify those characters. There seems to be an undocumented $tometa function which may do the job but if anyone knows anything that is documented, that would seem to be a safer option.
Many thanks,
Rupert Killik
------------------------------
Rupert Killik
Senior Software Engineer
Rocket Forum Shared Account
------------------------------