Re: EBCDIC to ASCII (Richard Gaskin)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: EBCDIC to ASCII (Richard Gaskin)

Quentin Long
sez Richard Gaskin <[hidden email]>:
> Anyone here have a function to translate the old EBCDIC encoding format
> to anything more modern format like ASCII or UTF-8?
Doubtful. If ESR is right about its "at least six mutually incompatible versions... and the absence of several ASCII punctuation characters... (exactly which characters are absent varies according to which version of EBCDIC you're looking at)", you'd pretty much *have to* roll your own conversion function. The "six mutually incompatible versions" thing strikes me as the most problematic, but since the forum member who's asking for this seems to be working with files from a single source, maybe it's safe to assume that all the relevant files use the same version of EBCDIC?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
   
Read the webcomic at [ http://www.atarmslength.net ]!
   
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: EBCDIC to ASCII (Richard Gaskin)

Richard Gaskin
Quentin Long wrote:

 > sez Richard Gaskin <ambassador at fourthworld.com>:
 >> Anyone here have a function to translate the old EBCDIC encoding
 >> format to anything more modern format like ASCII or UTF-8?
 >
 > Doubtful. If ESR is right about its "at least six mutually
 > incompatible versions... and the absence of several ASCII punctuation
 > characters... (exactly which characters are absent varies according
 > to which version of EBCDIC you're looking at)", you'd pretty much
 > *have to* roll your own conversion function. The "six mutually
 > incompatible versions" thing strikes me as the most problematic,
 > but since the forum member who's asking for this seems to be working
 > with files from a single source, maybe it's safe to assume that all
 > the relevant files use the same version of EBCDIC?

It's a mess alright, but most interesting to me is what turned out to be
the solution:

The OP in the forum thread that prompted my query noted that the FTP
server he's using is just old enough that it includes an EBCDIC-to-ASCII
algo built in, so that making the FTP request with "text" mode yields
usable ASCII data.

The trick then became finding out how to specify "text" mode when using
libURL, and the solution he found was quite simple once you learn enough
about FTP to know how to do it:

By default FTP deliveres requested files without alteration, but
apparently you can append the URL with ";TYPE=A" to tell the server to
deliver the output as ASCII (similar in some respects to how HTTP allows
arguments to be passed with GET as name-value pairs following a "?"
after the URL).

His post about that is here:
<http://forums.livecode.com/viewtopic.php?f=11&t=28576#p149747>

Interestingly, he notes that this only works when using "get" with
libURL, and not when using "put" - bug?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode