* Unescape URL Procedure
@ 2004-10-16 9:49 Andrew
2004-10-16 12:24 ` Pascal Obry
0 siblings, 1 reply; 3+ messages in thread
From: Andrew @ 2004-10-16 9:49 UTC (permalink / raw)
To: comp.lang.ada
Does anyone know of an Unescape URL procedure for Ada? If so, which
package?
Alternately maybe someone knows a short-cut to get %26 where 26 could be
replaced with a number in range 33-126, into it's actual character
representation; %26 is actually the '&' character. %26 corresponds to
16#26# (hex).
Just looking for 'tricks' and short-cuts to do this.
Andrew Carroll
Carroll-Tech
720-273-6814
andrew@carroll-tech.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unescape URL Procedure
[not found] <000901c4b365$719e8720$0201a8c0@win>
@ 2004-10-16 10:04 ` Marius Amado Alves
0 siblings, 0 replies; 3+ messages in thread
From: Marius Amado Alves @ 2004-10-16 10:04 UTC (permalink / raw)
To: comp.lang.ada
> Does anyone know of an Unescape URL procedure for Ada?
My program Decode_HH does something along this line:
-- It transforms any two hexadecimal digits prefixed by '='
-- into the corresponding character (Latin 1).
-- The first hexadecimal digit must be an uppercase letter.
-- It is a filter (uses standard input and output channels).
The program is published in the SDC forum, area Files / Software:
http://www.softdevelcoop.org
You must be a member to enter the Files area. Membership is open to all,
but for your convenience I copy the whole program below.
<<
-- Program Decode_HH
-- Version 1maa (2003-04-01)
-- (C) M�rio Amado Alves
-- ATTENTION: the use of this software is subject to conditions,
-- which the user must know in order to be in a legal state.
-- See bottom of the file.
-- This program restores email-mangled text originally containing Latin 1.
-- It transforms any two hexadecimal digits prefixed by '='
-- into the corresponding character (Latin 1).
-- The first hexadecimal digit must be an uppercase letter.
-- It is a filter (uses standard input and output channels).
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure Decode_HH_1maa is
T : String (1 .. 3);
subtype HH_Type is Natural range 0 .. 16#FF#;
package HH_IO is new Ada.Text_IO.Integer_IO (HH_Type);
N : HH_Type;
Dummy_Last: Positive;
Finish : exception;
procedure Get (S : out String) is
begin
for I in S'Range loop
begin
Get_Immediate (S (I));
exception
when End_Error =>
Put (S (S'First .. I - 1));
raise;
end;
end loop;
end;
begin
Get (T (1 .. 3));
loop
if T (1) = '='
and then T (2) in 'A' .. 'F'
and then Is_Hexadecimal_Digit (T (3))
then
HH_IO.Get ("16#" & T (2 .. 3) & "#", N, Dummy_Last);
Put (Character'Val (N));
Get (T (1 .. 3));
else
Put (T (1));
T (1 .. 2) := T (2 .. 3);
begin
Get_Immediate (T (3));
exception
when End_Error =>
Put (T (1 .. 2));
raise;
end;
end if;
end loop;
exception
when End_Error => null;
end;
-- REVISION HISTORY
-- 2003-04-01: version 1maa created and tested
-- CONDITIONS OF USE
-- This software is licensed under the terms of the
-- Software Developers Cooperative License, published at
--
-- groups.yahoo.com/group/softdevelcoop
--
-- In short, it is free for non-commercial use,
-- but royalties are due for use in a business.
-- See the website for details and contact information.
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unescape URL Procedure
2004-10-16 9:49 Andrew
@ 2004-10-16 12:24 ` Pascal Obry
0 siblings, 0 replies; 3+ messages in thread
From: Pascal Obry @ 2004-10-16 12:24 UTC (permalink / raw)
"Andrew" <andrew@carroll-tech.net> writes:
> Does anyone know of an Unescape URL procedure for Ada? If so, which
> package?
Of course ! See AWS.URL.Decode.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-16 12:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <000901c4b365$719e8720$0201a8c0@win>
2004-10-16 10:04 ` Unescape URL Procedure Marius Amado Alves
2004-10-16 9:49 Andrew
2004-10-16 12:24 ` Pascal Obry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox