Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use three dots instead of elipsis #162

Merged
merged 3 commits into from
Jul 13, 2020
Merged

Conversation

suricactus
Copy link
Collaborator

pylupdate5 hardcodes the output to ascii symbols, therefore any unicode is XML encoded and cannot be reverted to the original state.

Enforcing codecForTr to be utf8 does not work:
https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/pylupdate_main.py#L231
As the output is hardcoded as ASCII in
https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/metatranslator.cpp#L435

pylupdate5 hardcodes the output to ascii symbols, therefore any unicode
is XML encoded and cannot be reverted to the original state.

Enforcing `codecForTr` to be utf8 does not work:
https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/pylupdate_main.py#L231
As the output is hardcoded as ASCII in
https://github.com/baoboa/pyqt5/blob/31ef42563dbcaf3885da8803e2e5d84507141c9b/pylupdate/metatranslator.cpp#L435
@suricactus suricactus requested a review from m-kuhn July 7, 2020 10:19
@m-kuhn
Copy link
Member

m-kuhn commented Jul 7, 2020

😢

@m-kuhn
Copy link
Member

m-kuhn commented Jul 7, 2020

image

does this help us to recover utf-8 from those mangled poor characters? Will need a bit of preprocessing of the string though, but having proper unicode support in qgispluginci would be great.

@suricactus
Copy link
Collaborator Author

Unfortunately not, because the characters are encoded byte by byte, not char by char.

>>> import html
>>> html.unescape('опа') # cyrillic "опа" (latin: opa)
'опа'
>>> html.unescape('…') # elipsis is encoded for each individual byte
'…'

@m-kuhn
Copy link
Member

m-kuhn commented Jul 7, 2020

what about creating a .pro?

@suricactus
Copy link
Collaborator Author

suricactus commented Jul 7, 2020

It is using the same codecForTr parameter as in the first post, it does not work.

Fake news up there, actually it works, but because of fetchtr_py function that is called only when .pro file is present. I will create such file.

@m-kuhn
Copy link
Member

m-kuhn commented Jul 8, 2020

How far did you go with migration of pylupdate to qgis-plugin-ci?

@suricactus
Copy link
Collaborator Author

I am testing opengisch/qgis-plugin-ci#18 and if all good, then I will revert the changes here.

@suricactus
Copy link
Collaborator Author

Just to unblock the change to go further, temporary use the mask as obsolete method trUtf8 instead of tr. There is no other disadvantage of using the trUtf8 for now, except a warning and possible post-qt5 era need for porting.

https://doc.qt.io/qt-5/qobject-obsolete.html#trUtf8

When the .pro workaround is proved to work properly and merged at qgis-plugin-ci, we can get rid of trUtf8 calls.

@m-kuhn m-kuhn merged commit 8313ce3 into opengisch:master Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants