<table><tr><td style="">bruns created this revision.<br />bruns added a reviewer: Frameworks.<br />Herald added projects: Frameworks, Build System.<br />Herald added subscribers: kde-buildsystem, kde-frameworks-devel.<br />bruns requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15068">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Depending on the locale, python3 may try to decode the source as ASCII<br />
when the file is opened in text mode. This will fail as soon as the<br />
code contains utf-8, e.g. (c) symbols.</p>

<p>While it is possible to specify the encoding when reading the file,<br />
this is bad for several reasons:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">only a very small part of the source is processed via _read_source, no need to decode the complete source and store it as string objects</li>
<li class="remarkup-list-item">the clang Cursor.extent.{start,end}.column refers to bytes, not multibyte characters.</li>
</ul>

<p>While python2 processes utf-8 containing sources without error messages,<br />
wrong extent borders are also an issue.</p>

<p>The practical impact is low, as the issue only manifests if there is a<br />
multibyte character in front of *and* on the same line as the read token.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Python3: Build any bindings which contains sources with non-ASCII codepoints,<br />
e.g. kcoreaddons. Unpatched version fails when using e.g. LANG=C.<br />
Python2: Both versions generate sources successfully.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15068">https://phabricator.kde.org/D15068</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>find-modules/sip_generator.py</div></div></div><br /><div><strong>To: </strong>bruns, Frameworks<br /><strong>Cc: </strong>kde-frameworks-devel, kde-buildsystem, michaelh, ngraham, bruns<br /></div>