Dear Dave, Thank you very much for adding another fix! I agree, unicode can get quite tricky. We had to do quite a few adjustments in our services to handle it.
Best regards, Andrii On 17/01/2017 21:33, Dave Kuhlman wrote: > Andrii, > > Thanks for catching this. > > That fix seems good to me. I've added it. It's basically your fix, > I believe, with a little bit of extra caution added to protect > against converting a string that is not unicode. Perhaps that > cannot occur, but I worry. Oh, and I used isinstance to check the > type, which I should have done to begin with. > > Attached is a patch. And, the change is also at the Bitbucket repo: > https://bitbucket.org/dkuhlman/generateds > > Sigh. I finally figured out why my tests did not exhibit this bug. > I was exporting with the standard, unmodified module generated by > generateDS.py. That code uses sys.stdout to write its output, and > apparently the file sys.stdout does not throw an exception when you > write non-ascii, unicode characters to it, whereas a file opened > with open('xxx', 'w') does cause an exception. I wonder how many > more weird things there are for me to learn about unicode? > > Thanks again for your help with this. > > Dave > > > On Tue, Jan 17, 2017 at 02:36:26PM +0000, Andrii Iudin wrote: >> Dear Dave, >> >> Many thanks for implementing and providing the fix. It has solved the >> problem with the export part. However, now there is a problem with >> outfile.write(self.convert_unicode(self.valueOf_)) >> >> Python seems to be refusing to write unicode into a file. It may be solved >> by encoding to utf-8 in >> def convert_unicode(instring): >> ... >> result = quote_xml(instring).encode('utf8') >> >> Please tell if this looks like a reasonable solution. >> >> Also, thank you for praising the EBI site! Even though we do only a part of >> the work (there are many teams here responsible for different services), it >> is very nice to hear. >> >> Best regards, >> Andrii >> >> On 17/01/2017 00:20, Dave Kuhlman wrote: >>> generateDS.py is attached. >>> >>> Dave >>> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users