Closed Bug 1585686 Opened 5 years ago Closed 5 years ago

UnicodeEncodeError: 'ascii' codec can't encode character '\u2716' in position 9: ordinal not in range(128)

Categories

(Firefox :: Messaging System, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 71
Iteration:
71.3 - Sept 30 - Oct 13
Tracking Status
firefox71 --- fixed

People

(Reporter: Mardak, Assigned: andreio)

References

(Regression)

Details

(Keywords: github-merged, regression)

Attachments

(1 file)

Stylish is trying to print ✖ 0 problems (0 errors, 0 warnings) (the first character is '\u2716')

Error running mach:

    ['lint', 'browser/components/newtab']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

UnicodeEncodeError: 'ascii' codec can't encode character '\u2716' in position 9: ordinal not in range(128)

  File "/mozilla-central/tools/lint/mach_commands.py", line 80, in lint
    return cli.run(*runargs, **lintargs)
  File "/mozilla-central/python/mozlint/mozlint/cli.py", line 217, in run
    print(out, file=output_file)

https://searchfox.org/mozilla-central/rev/f372e8a46ef7659ef61be9938ec2a3ea34d343c6/python/mozlint/mozlint/cli.py#215-216

            output_file = open(path, 'w') if path else sys.stdout
            print(out, file=output_file)

I think it's trying to print to stdout… ?

andreio noticed that previously with python2, our taskcluster linux output showed ? 0 problems (0 errors, 0 warnings) so perhaps python2 automatically converted the non-ascii character to "?" while python3 throws an error instead.

Assignee: nobody → andrei.br92
Iteration: --- → 71.3 - Sept 30 - Oct 13
Priority: -- → P1

Hm, I'm not really sure why this is happening. Does setting PYTHONIOENCODING=utf-8 fix it? I suspect this might be an issue with your environment's locale/terminal encoding. Though if we can fix this for people we definitely should.

Yes this seems to be an issue with the environment. The fix in this case was to:

export LC_ALL=C.UTF-8
Component: Lint and Formatting → Messaging System
Keywords: github-merged
Product: Firefox Build System → Firefox
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b995dbfa4d87
[mozlint] Avoid UnicodeEncodeError for users who have an 'ascii' locale r=gbrown
Blocks: 1586093
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 71
Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: