Skip to content

Set xgettext encoding to UTF-8 (#11080)#11081

Merged
feerrenrut merged 1 commit intonvaccess:masterfrom
accessolutions:i11080-xgettext
May 4, 2020
Merged

Set xgettext encoding to UTF-8 (#11080)#11081
feerrenrut merged 1 commit intonvaccess:masterfrom
accessolutions:i11080-xgettext

Conversation

@JulienCochuyt
Copy link
Contributor

Link to issue number:

Fixes #11080

Summary of the issue:

Current xgettext integration does not allow to follow copyright headers guidelines as xgettext complains about non-ASCII characters found in author names.

Description of how this pull request fixes the issue:

Setting UTF-8 as the source files encoding upon invoking xgettext from Scons.

Testing performed:

Building POT.

Known issues with pull request:

The proposed change automatically considers all source files as encoded in UTF-8, which is the standard in Python 3.
If we still were using Python 2, I would have instead advocated for the use of an encoding declaration header line in each incriminated source file, such as:

# -*- coding: utf-8 -*-

Change log entry:

I do not think this deserves a change log entry.

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JulienCochuyt

Does this mean we have no use for the utf-8 encoding headers now? Should they be removed from the developer guide?

@feerrenrut feerrenrut merged commit 9676797 into nvaccess:master May 4, 2020
@nvaccessAuto nvaccessAuto added this to the 2020.1 milestone May 4, 2020
@JulienCochuyt
Copy link
Contributor Author

@feerrenrut wrote:

Does this mean we have no use for the utf-8 encoding headers now? Should they be removed from the developer guide?

Considering Python 3 source files are expected to be encoded in UTF-8, encoding declaration in the header of files containing non-ASCII characters is, as of this PR, technically superfluous.

On the other hand, it could be considered as a reminder to individual contributors to check the settings of their editor of choice before messing up with the source file. It also instruct many editors to automatically apply the proper encoding.

Given this, I guess instructing to add it or not is by now just a matter of style.

@feerrenrut feerrenrut modified the milestones: 2020.1, 2020.2 May 4, 2020
@JulienCochuyt JulienCochuyt deleted the i11080-xgettext branch May 4, 2020 16:22
feerrenrut pushed a commit that referenced this pull request May 4, 2020
Follow up #11081 
Set Flake8 encoding to UTF-8
JulienCochuyt added a commit to accessolutions/nvda that referenced this pull request Jul 2, 2020
feerrenrut added a commit to nvaccess/mrconfig that referenced this pull request Sep 11, 2020
Since nvaccess/nvda#11081 it is expected that
xgettext should be run by manually specifying the file encoding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Current xgettext integration does not allow to follow copyright headers guidelines

4 participants