Skip to content

Instantly share code, notes, and snippets.

@cowo78
Last active February 19, 2020 09:04
Show Gist options
  • Save cowo78/26057f575ddfa3ee20a0b636acd894ff to your computer and use it in GitHub Desktop.
Save cowo78/26057f575ddfa3ee20a0b636acd894ff to your computer and use it in GitHub Desktop.
pylupdate5 5.14.1 tr() and UTF8 on windows
Case 1 - NOT working
-------------------------------------------------------------------------------
tr()
# CODECFORSRC = UTF-8
# CODECFORTR = UTF-8
Message created:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xc3;&#xa7;&#xc2;&#xb0;&#xc2;&#xa7;</source>
<translation type="unfinished"></translation>
</message>
Repeated runs OK.
Linguist shows WRONG characters as the source is incorrectly formatted.
Case 2 - NOT working
-------------------------------------------------------------------------------
tr()
CODECFORSRC = UTF-8
# CODECFORTR = UTF-8
Message created the FIRST time and subsequent ODD runs
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation type="unfinished"></translation>
</message>
Message created the SECOND time and subsequent EVEN runs
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xc3;&#xa7;&#xc2;&#xb0;&#xc2;&#xa7;</source>
<translation type="unfinished"></translation>
</message>
Case 3 - NOT working
-------------------------------------------------------------------------------
tr()
# CODECFORSRC = UTF-8
CODECFORTR = UTF-8
Message created:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xc3;&#xa7;&#xc2;&#xb0;&#xc2;&#xa7;</source>
<translation type="unfinished"></translation>
</message>
Linguist shows WRONG characters as the source is incorrectly formatted.
Case 4 - NOT working
-------------------------------------------------------------------------------
tr()
CODECFORSRC = UTF-8
CODECFORTR = UTF-8
Message created:
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Repeated pylupdate5 runs are OK, the same message is consistently generated.
Processed by linguist 5.13.2:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation>utf8</translation>
</message>
Reprocessed by pylupdate5:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation>utf8</translation>
</message>
Reprocessed by pylupdate5 on subsequent runs:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation type="obsolete">utf8</translation>
</message>
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xc3;&#xa7;&#xc2;&#xb0;&#xc2;&#xa7;</source>
<translation type="unfinished"></translation>
</message>
Using trUtf8 I ALWAYS get a 'Non-ASCII character detected in trUtf8 string' warning
Case 1 - NOT working
-------------------------------------------------------------------------------
trUtf8()
# CODECFORSRC = UTF-8
# CODECFORTR = UTF-8
Message created:
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Repeated pylupdate5 runs are OK, the same message is consistently generated.
Processed by linguist 5.13.2:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation>UTF8</translation>
</message>
Reprocessed by pylupdate5
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation type="obsolete">UTF8</translation>
</message>
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Case 2 - NOT working
-------------------------------------------------------------------------------
trUtf8()
CODECFORSRC = UTF-8
# CODECFORTR = UTF-8
Message created the FIRST time and subsequent ODD runs
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: 簧</source>
<translation type="unfinished"></translation>
</message>
Message created the SECOND time and subsequent EVEN runs
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Case 3 - NOT working
-------------------------------------------------------------------------------
trUtf8()
# CODECFORSRC = UTF-8
CODECFORTR = UTF-8
Message created:
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Repeated pylupdate5 runs are OK, the same message is consistently generated.
Processed by linguist 5.13.2:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation>utf8</translation>
</message>
Reprocessed by pylupdate5
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation type="obsolete">utf8</translation>
</message>
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Case 4 - NOT working
-------------------------------------------------------------------------------
trUtf8()
CODECFORSRC = UTF-8
CODECFORTR = UTF-8
Message created:
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Repeated pylupdate5 runs are OK, the same message is consistently generated.
Processed by linguist 5.13.2:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation>utf8</translation>
</message>
Reprocessed by pylupdate5:
<message>
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: &#xe7;&#xb0;&#xa7;</source>
<translation type="obsolete">utf8</translation>
</message>
<message encoding="UTF-8">
<location filename="../translations_for_testsuite.py" line="6"/>
<source>this needs UTF8 encoding: ç°§</source>
<translation type="unfinished"></translation>
</message>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment