22 lines
685 B
Plaintext
22 lines
685 B
Plaintext
code Text=12;
|
|
string 0; \use zero-terminated strings
|
|
|
|
func Encode(S0); \Encode URL string and return its address
|
|
char S0;
|
|
char HD, S1(80); \BEWARE: very temporary string space returned
|
|
int C, I, J;
|
|
[HD:= "0123456789ABCDEF"; \hex digits
|
|
I:= 0; J:= 0;
|
|
repeat C:= S0(I); I:= I+1;
|
|
if C>=^0 & C<=^9 ! C>=^A & C<=^Z ! C>=^a & C<=^z ! C=0
|
|
then [S1(J):= C; J:= J+1] \simply pass char to S1
|
|
else [S1(J):= ^%; J:= J+1; \encode char into S1
|
|
S1(J):= HD(C>>4); J:= J+1;
|
|
S1(J):= HD(C&$0F); J:= J+1;
|
|
];
|
|
until C=0;
|
|
return S1;
|
|
];
|
|
|
|
Text(0, Encode("http://foo bar/"))
|