Skip to main content

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

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

Hello,

You have to specify in the [SETTINGS] section of the assignment file :

$NEW_LINE = CRLF



------------------------------
FELIX HAZIZA
CEO
Pacific Informatique
SAINT-DIDIER FR
------------------------------

Hello,

You have to specify in the [SETTINGS] section of the assignment file :

$NEW_LINE = CRLF



------------------------------
FELIX HAZIZA
CEO
Pacific Informatique
SAINT-DIDIER FR
------------------------------

Hi Felix
Problem is here, that $NEW_LINE is valid for both direction: writing and reading.
But I believe, that on reading UnifAce will except any combination of CR and LF  :-)



------------------------------
Ingo Stiller
Aareon Deutschland GmbH
------------------------------

Hello,

You have to specify in the [SETTINGS] section of the assignment file :

$NEW_LINE = CRLF



------------------------------
FELIX HAZIZA
CEO
Pacific Informatique
SAINT-DIDIER FR
------------------------------

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

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

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


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

Hi Gianni,

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.

Best regards,



------------------------------
Rupert Killik
Senior Software Engineer
Rocket Forum Shared Account
------------------------------