Silverlight (at the CLR level) only includes UTF8 - no other encodings are available. That's the reason why latin_1 isn't available (which makes sense) and basically the reason why UnicodeEncodeError isn't available (which makes less sense as I think we're just missing the .NET exception to map it onto).
We could certainly fix the missing UnicodeEncodeError but for latin-1 you could probably publish your own latin_1_encode method into the codecs module. > -----Original Message----- > From: [email protected] [mailto:users- > [email protected]] On Behalf Of Michael Foord > Sent: Monday, March 08, 2010 4:32 AM > To: Discussion of IronPython > Subject: [IronPython] Silverlight: UnicodeEncodeError not defined and other > encoding issues > > Hey all, > > Using Silverlight 2.6.1 RC: > > NameError: global name UnicodeEncodeError is not defined > > Oops (and a problem for us). > > Also: 'some string'.encode('latin-1') results in: > > LookupError: unknown encoding: latin-1 > > If I then add the codecs and encodings standard library modules to our > application I get the following exception: > > AttributeError: 'module' object has no attribute 'latin_1_encode' > > The error is in line 17 of the encodings/latin_1.py module: > > encode = codecs.latin_1_encode > > This unfortunately kills a fair bit of Python code and means I'm going > to have to rewrite a chunk of the library we're using. :-( > > Thanks > > Michael Foord > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf > of your employer, to release me from all obligations and waivers arising > from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, > shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, > non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have > entered into with your employer, its partners, licensors, agents and > assigns, in perpetuity, without prejudice to my ongoing rights and > privileges. You further represent that you have the authority to release > me from any BOGUS AGREEMENTS on behalf of your employer. > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
