"""
Decode_Quoted_Printable.py - A Jython macro for jEdit
that decodes the buffer in the current textArea from
Quoted Printable to plain text.

Copyright (C) 2002 Ollie Rutherfurd <oliver@rutherfurd.net>

$Id: Decode_Quoted_Printable.py 28 2003-03-25 22:40:28Z oliver $
"""

try:
	import cStringIO as StringIO
except ImportError:
	import StringIO

import quopri

def decodeBuffer(textArea):
	inp,out = StringIO.StringIO(),StringIO.StringIO()
	try:
		inp.write(textArea.getText())
		inp.seek(0)
		quopri.decode(inp,out)
		out.seek(0)
		textArea.setText(out.read())
	finally:
		inp.close()
		out.close()

if __name__ in ('__main__','main'):
	decodeBuffer(init.textArea)

# :indentSize=4:lineSeparator=\n:noTabs=false:tabSize=4:

