Coder Social home page Coder Social logo

Comments (7)

izimobil avatar izimobil commented on August 15, 2024

Original comment by Rick Shi (Bitbucket: alassius, GitHub: alassius):


I can confirm that the problem is solved in the newest revision. Thanks!

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


Changes have been commited since this patch, and all tests pass, does the problem occurs with the current code (tip version:
http://bitbucket.org/izi/polib/changesets) ?

Please get the tip version and check if the problem is still there.

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by Rick Shi (Bitbucket: alassius, GitHub: alassius):


Hi, I was too lazy to create an account...

Your patch is giving me this error: "str() takes exactly 1 argument (2 given)". I tried to debug it, but I get a Python crash (!!) if I try to print an entry. The exception is thrown in _BaseFile.str(). Can you take another look? Sorry that I don't have much time to spend on it.

Rick

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


argh... bitbucket doesn't send me email updates... (maybe because your reporting as anonymous, not sure).

Anyway, sorry for the delay, so: does the patch solves the bug ?

Thanks !

--
David

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by Anonymous:


I see that you've already done the str -> unicode conversion, thanks!

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by Anonymous:


Surprise surprise, I just found out that the patch breaks file saving. The file object returned by codecs.open() with an encoding is different from the object returned by open(). Both read() and write() methods are expecting unicode. Rosetta's download feature writes to StringIO instead, which is why my patch worked there.

If polib treats strings as unicode (which is nice), perhaps it would be worth the effort to prefix all string literals with u? That would make it more obvious what we're dealing with. More importantly, str() should definitely return str objects. So maybe rename all str() to unicode()?

Rick

from polib.

izimobil avatar izimobil commented on August 15, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


Hi,

The patch you are proposing is not ok for several reasons :

  • polib threats all strings as unicode internally, so the encode() must be done as late as possible,
  • the po files encoding is not always "utf-8".

But you are right, the str method is not bullet proof ...
Can you tell me if the problem is solved with the attached patch ?

Regards,

--
David

from polib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.