Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Encoded lines in email, parsing/decoding in Rebol?

From: brett:codeconscious at: 30-Apr-2002 23:53

Hi Mat,
> This appears to be a Japanese name specified on the From: line with a > Japanese character set. I didn't even know you could do this!
I've not seen one of those either. But since Japan's Prime Minister is in Australia at the moment, I thought I'd investigate a little bit. I found this helpful item on searching with Google. http://wuarchive.wustl.edu/packages/first-virtual/nsb/MIME-tutorial.ps Googles text translation: http://216.239.35.100/search?q=cache:XOfHNdxE6fIC:wuarchive.wustl.edu/packag es/first-virtual/nsb/MIME-tutorial.ps+%22%3D%3FISO-2022-JP%3FB%3F%22+example +encoding+character&hl=en In particular: =?CHARSET?ENCODING?DATA? Where ENCODING is B or Q - B for base64 Q for quoted-printable So for your example you take the DATA bit between the last two "?" and debase/base data 64 on it. Then you do a to-string on the result. Where you go from here I don't know. Now if debase crashes on you - you can try this workaround (watch line wraps): debase: function [ {Converts a string from a different base representation to binary. Note: This is a patched version.} value [any-string!] "The string to convert" /base {Allow a selection of a different base for conversion} base-value [integer!] "The base to convert from: 64, 16, or 2" ] [tmp] [ if not base [base-value: system/options/binary-base] if not found? find [64 16 2] base-value [return none] tmp: either string? value [copy value] [to-string value] RETURN first load/all append insert tmp compose [(base-value) "#{"] } ] I hope it helps. I'd be interested in your findings. Brett.