From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e49f3406d01891d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Marius Amado Alves Newsgroups: comp.lang.ada Subject: Re: Unescape URL Procedure Date: Sat, 16 Oct 2004 11:04:59 +0100 Organization: Cuivre, Argent, Or Message-ID: References: <000901c4b365$719e8720$0201a8c0@win> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: melchior.cuivre.fr.eu.org 1097921097 18257 212.85.156.195 (16 Oct 2004 10:04:57 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sat, 16 Oct 2004 10:04:57 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en In-Reply-To: <000901c4b365$719e8720$0201a8c0@win> X-OriginalArrivalTime: 16 Oct 2004 10:04:38.0568 (UTC) FILETIME=[8C09EA80:01C4B367] X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at rfc1149.net X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:5310 Date: 2004-10-16T11:04:59+01:00 > 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. >>