From: Godefroid C. <go...@sw...> - 2002-09-04 14:20:47
|
Sorry if the moderator does approve this mail and you get it twice... >Hi all, > >I am experimenting with the following code: > >from java import applet, awt >from java.awt.event import ItemEvent >from pawt import GridBag > >import xmlrpclib >import types >import encodings.iso8859_1 > >class XMLRPCDemo(applet.Applet): > def init(self): > self.results = awt.TextArea(10, 40, editable=0) > self.fetch = awt.Button('Fetch', actionPerformed=self.call) > self.address = awt.TextField('http://localhost/', 10) > self.param = awt.TextField('water parks', 10) > > bag = GridBag(self) > bag.addRow(self.address, fill='HORIZONTAL') > bag.addRow(self.param, fill='HORIZONTAL') > bag.addRow(self.fetch, fill='VERTICAL') > bag.add(self.results, > fill='BOTH', weightx=1.0, weighty=1.0, > gridheight=2) > > def call(self, e): > server = xmlrpclib.Server(self.address.getText(), > encoding="iso-8859-1") > param = self.param.getText() > try: > self.results.append('keyword: %s\n' % param) > results = server.xacti(param) > self.results.append(repr(results)+ '\n\n') > except Exception, e: > self.results.append(str(e)) > >if __name__ == '__main__': > import pawt > pawt.test(XMLRPCDemo()) > >It works perfectly when running it with jython. > > > >After compiling with "jythonc --core --deep --jar appletdemo.jar >XMLRPCDemo.py", I get an applet >I load it in a browser and get the following message in the textarea after >clicking the fetch button. > >keyword: water parks >unknown encoding iso-8859-1 > >Before adding the > >import encodings.iso8859_1 > >statement, I had > >no codec search functions registered: can't find encoding > >error message. > >Can someone tell me if it is possible to use encodings in applets ? > >Thanks. -- Godefroid Chapelle BubbleNet sprl rue Victor Horta, 18 / 202 1348 Louvain-la-Neuve Belgium Tel + 32 (10) 459901 Mob + 32 (477) 363942 TVA 467 093 008 RC Niv 49849 |