[IronPython] bug with str.encode() (diff with GNU python)

Stanislas Pinte stan at ertmssolutions.com
Fri Aug 18 17:25:36 CEST 2006


Dino Viehland a écrit :
> Thanks for the bug report.  I've opened this as CodePlex bug #2290.  I've tentatively opened this as a 1.01 bug so let us know if this is blocking you.

No emergency, thanks, I have a workaround!

Congrat. for quick answer!

Stan.

> 
> One workaround is to do:
> 
> 'abc'.encode(sys.getdefaultencoding())
> 
> Which will work on both CPython & IronPython.
> 
> You could also pass None in on IronPython but that doesn't work on CPython.  I've put that in the bug as well and we'll fix that one too :).
> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Stanislas Pinte
> Sent: Friday, August 18, 2006 6:08 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] bug with str.encode() (diff with GNU python)
> 
> more info on what 2.4 should be:
> 
>> encode(       [encoding[,errors]])
>>     Return an encoded version of the string. Default encoding is the current default string encoding. errors may be given to set a different error handling scheme. The default for errors is 'strict', meaning that encoding errors raise a UnicodeError. Other possible values are 'ignore', 'replace', 'xmlcharrefreplace', 'backslashreplace' and any other name registered via codecs.register_error. For a list of possible encodings, see section 4.9.2. New in version 2.0. Changed in version 2.3: Support for 'xmlcharrefreplace' and 'backslashreplace' and other error handling schemes added.
> 
> 
> 
> Stanislas Pinte a écrit :
>> Hello,
>>
>> [sim-ironpython]> python
>> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
>> on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> "a".encode()
>> 'a'
>>>>> ^Z
>> [sim-ironpython]> ironpython/ipy.exe
>> IronPython 1.0.60816 on .NET 2.0.50727.42 Copyright (c) Microsoft
>> Corporation. All rights reserved.
>>>>> "a".encode()
>> Traceback (most recent call last):
>>   File , line 0, in <stdin>##86
>> TypeError: encode() takes at least 1 argument (0 given)
>>
>>
> 
> 
> --
> -----------------------------------------------------------------
>    Stanislas Pinte             e-mail: stan at ertmssolutions.com
>    ERTMS Solutions               http://www.ertmssolutions.com
>    Rue de l'Autonomie, 1             Tel:    + 322 - 522.06.63
>    1070        Bruxelles              Fax:   + 322 - 522.09.30
> -----------------------------------------------------------------
>    Skype (http://www.skype.com) id:                  stanpinte
> -----------------------------------------------------------------
> 
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 


-- 
-----------------------------------------------------------------
   Stanislas Pinte             e-mail: stan at ertmssolutions.com
   ERTMS Solutions               http://www.ertmssolutions.com
   Rue de l'Autonomie, 1             Tel:    + 322 - 522.06.63
   1070        Bruxelles              Fax:   + 322 - 522.09.30
-----------------------------------------------------------------
   Skype (http://www.skype.com) id:                  stanpinte
-----------------------------------------------------------------




More information about the Ironpython-users mailing list