[img] GSTrans string encoding/decoding
 MDFS::Info.Comp.ProgTips.GSTrans Search  

GSTrans string encoding is a method of encoding all 8-bit values 0-255 as printable characters. It is normally used as a way of passing non-printable characters on a command line, such as with the *KEY and *ECHO commands, for example: *KEY 4 RUN|M or *ECHO |V|F|S|@4000. It is also used to pass binary data over a text-only link, such as with TeleSoftware and some email protocols.

FileLanguageRoutines
GSTrans.bbc (L) BBC BASICGS_Decode, GS_Encode
GSTrans.c Cgs_trans()
GSTrans11.mac PDP11
GSTrans65.txt 6502GSInit, GSRead
Echo.s (L) Source for *ECHO for BBC series
Echo GSTrans'd string.
GSEcho (L) BBC BASIC
RISC OS command
Echo a GSTrans'd string.
GSEcho.bbc (L)
GSEcho.exe
BBC BASIC
Windows/DOS command
Echo a GSTrans'd string.
GSenc.bbc (L)
GSenc.exe
BBC BASIC
Windows/DOS command
Create a GSEncoded file.
Syntax: GSenc <infile> (<gsfile>)
GSdec.bbc (L)
GSdec.exe
BBC BASIC
Windows/DOS command
Decode a GSEncoded file.
Syntax: GSdec <gsfile> (<outfile>)
Implementations can include GSInit, GSRead routines to translate character by character and GSEncode, GSDecode routines to translate whole strings in one go. Decoding methods deal with invalid sequences in different ways, either reporting an error or skipping them.

Characters are encoded with the | escape character in the following way:

 Character Encoding
 0-31      |letter eg |@, |A, |i |[ etc., case ignored
 32-126    character, except for:
 "         |"
 |         ||
 127       |?
 128-255   |! followed by encoding, eg |!|@ = 128
 
A string can be surrounded in quotes, eg "ALERT|G".
See also RISCOS documentation.

Demo of GSECHO on DOS/Windows

Demo of GSENC on DOS/Windows


Authored by J.G.Harston
Last update: 04-Jun-2023