How can the user decide in your method? I don't see it. Steve
On Jan 27, 2013, at 3:15 AM, Wander Lairson Costa <wander.lair...@gmail.com> wrote: > 2013/1/26 Steven Michalske <smichal...@gmail.com>: >> What about this? >> Tested in python 2.7 and 3.3 >> >> a = array.array("B") >> s=u"abcꬦ" >> try: >> a.fromstring(s.encode('ascii')) >> except UnicodeEncodeError: >> a.fromstring(s.encode('utf8')) >> print(a) >> array('B', [97, 98, 99, 234, 172, 166]) >> >> a = array.array("B") >> s="abc" >> try: >> a.fromstring(s.encode('ascii')) >> except UnicodeEncodeError: >> a.fromstring(s.encode('utf8')) > > I think is better to let the user decides which encoding he prefers. > > -- > Best Regards, > Wander Lairson Costa > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users