Comments (7)
Original comment by Rick Shi (Bitbucket: alassius, GitHub: alassius):
I can confirm that the problem is solved in the newest revision. Thanks!
from polib.
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.
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.
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.
Original comment by Anonymous:
I see that you've already done the str -> unicode conversion, thanks!
from polib.
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.
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)
- (Un)escape more characters HOT 1
- (faulty issue)
- _BaseEntry/POEntry constructors have bad signatures HOT 1
- New release?
- Drop py<=3.6 and clean up/modernize the code?
- Trying to open a non-existant .po file gives incorrect error HOT 3
- sdist is missing tox.ini
- List of occurrences wrapped differently than xgettext
- "OSError: Syntac Error" when file not found HOT 2
- How to wrap the "msgstr" with the specified width? HOT 2
- [question] How to get same behaviour of po4a in wrap? HOT 3
- Docu: Icons missing
- Docu: Dead link
- Docu: _BaseFile class not documented via Sphinx
- Docu: POEntry.__init__() docstring not in Sphinx output
- Please add support for extracted comments HOT 4
- Add ignore_errors parameter to polib.pofile
- Does polib compile into mo wihout "msgfmt"? HOT 6
- test_save_as_mofile fails with gettext 0.22+ HOT 2
- DeprecationWarning: It is deprecated to return a value that is not None from a test cas
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polib.