View previous topic :: View next topic
|
Author |
Message |
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Scenario:
There is a file, encoded in UTF-8 on Windoze. FTP'ing it to z/OS will translate normal ASCII into normal EBCDIC, and UTF-8 into "gibberish", but the transfer back to the PC will un-gibberize this gibberish nicely back to UTF-8, so that's not the problem.
The problem is that on z/OS I don't not know the real length of the gibberish as UTF-8 data, unless I actually start scanning for the translated-to-gibberish first UTF-8 characters, and use a translate table to establish the length of the UTF-8 character in bytes, because
the output is a table where the borders are made up of +/-/| characters, and they need to be aligned when the file is later re-opened on the PC, and obviously ä in EBCDIC (aka ä in UTF-8) have different lengths, and just willy-nilly putting '|'s in column xxx after 42 bytes of data will not really result in a nice table on the PC.
Any suggestions? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
You can take your gibberish description of the problem without any data to the recycle bin where it belongs. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
vasanthz wrote: |
You can take your gibberish description of the problem without any data to the recycle bin where it belongs. |
Code: |
| Süd | Sud |
| Nord | Nord | |
Nice aligned on z/OS. Now, in this case, ind$file back to PC, display in a UTF-8 aware editor and you'll get
Code: |
| Süd | Sud |
| Nord | Nord | |
Bye-bye alignment. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Solved it, for this particular case, by adding an extra comment-type line to the PC file, containing the 224 ASCII characters from 0x20 (space) to 0xff. In PL/I this will allow the simple combination of translate() + sum() determine the number of UTF-8 characters. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
And for what it's worth, the method doesn't care about the method of transferring the PC file to a z/OS dataset, be it IND$FILE or FTP, provided the transfer is strictly one-to-one. |
|
Back to top |
|
|
|