decoding "quoted-printable"

Mark Smith mark at maseurope.net
Tue Jun 5 07:29:24 EDT 2007


Klaus, I just checked up on Wikipedia : http://en.wikipedia.org/wiki/ 
Quoted-printable

and remembered why I didn't write a more complete function! (My use  
of it only involved very short strings - no line endings or other  
complications).

A quick (and probably innacurate) reading of the wikipedia page  
suggests that the only non-hex characters that should follow an "="  
would be Tab(9), Space(32), CR(10) & LF(13), so maybe that could help?

Best,

Mark

On 5 Jun 2007, at 12:12, Klaus Major wrote:

>> function decodeQP pStr
>>   put 0 into tc
>>   repeat for each char c in pStr
>>     if c is "=" then put 1 into tc
>>     if tc = 0 then
>>       put c after decodedStr
>>     else
>>       if c is not "=" then
>>         put c into char tc of hexVal
>>         add 1 to tc
>>       end if
>>       if tc = 3 then
>>         put numToChar(baseConvert(hexVal,16,10)) after decodedStr
>>         put 0 into tc
>>       end if
>>     end if
>>   end repeat
>>   return decodedStr
>> end decodeQP




More information about the use-livecode mailing list