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

Unicode/Locale compilation error #1513

Open
3 tasks done
exipilis opened this issue Oct 2, 2022 · 19 comments
Open
3 tasks done

Unicode/Locale compilation error #1513

exipilis opened this issue Oct 2, 2022 · 19 comments
Assignees
Labels
os: macos Specific to macOS operating system type: imperfection Perceived defect in any part of project

Comments

@exipilis
Copy link

exipilis commented Oct 2, 2022

Describe the problem

Compilation error:

Traceback (most recent call last):
  File "__main__.py", line 317, in <module>
  File "click/core.py", line 1134, in __call__
  File "click/core.py", line 1040, in main
  File "click/_unicodefun.py", line 100, in _verify_python_env
RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/unicode-support/ for mitigation steps.

This system lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8
[38295] Failed to execute script __main__

exit status 1

Compilation error: exit status 1

Tried setting locale to uk_UA.UTF-8, en_US.UTF-8, C.UTF-8 etc. No effect.

To reproduce

  1. File -> Examples -> 01. Basics -> Blink
  2. Click Verify.

Expected behavior

Compilation success.

Arduino IDE version

Original report

2.0.0

Last verified with

2.0.3

Operating system

macOS

Operating system version

12.2, 13.1

Additional context

Additional reports

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@exipilis exipilis added the type: imperfection Perceived defect in any part of project label Oct 2, 2022
@per1234
Copy link
Contributor

per1234 commented Oct 2, 2022

Hi @exipilis. Thanks for your report.

Which board do you have selected in the Tools > Board menu in the Arduino IDE when you get this error?

What is the normal locale on your system?

@per1234 per1234 self-assigned this Oct 2, 2022
@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label Oct 2, 2022
@exipilis
Copy link
Author

exipilis commented Oct 2, 2022

@per1234 it was nRF52840 Feather Sense by Adafruit.

@per1234
Copy link
Contributor

per1234 commented Oct 2, 2022

It seems the problem is caused by a misconfiguration of the locale on your computer. There is some information about it here:

https://click.palletsprojects.com/en/8.1.x/unicode-support/#surrogate-handling

The problem is either with your system, the 3rd party "adafruit-nrfutil" tool used for compilation and uploading specific to your board, or perhaps even the upstream Nordic Semiconductor "nRF Util" project forked by Adafruit.

Since this does not seem to be directly related to the Arduino IDE codebase hosted in this repository, this issue tracker will not be an appropriate place for further discussion of the issue. You are welcome to request assistance over on the Arduino forum though:

https://forum.arduino.cc/

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2022
@per1234 per1234 added conclusion: off topic Off topic for this repository and removed status: waiting for information More information must be provided before work can proceed labels Oct 2, 2022
@exipilis
Copy link
Author

exipilis commented Oct 2, 2022

@per1234 it works perfectly on Arduino IDE 1.8.19 somehow.

@per1234 per1234 reopened this Oct 27, 2022
@per1234
Copy link
Contributor

per1234 commented Oct 27, 2022

Thanks @exipilis. I apologize for taking so long to circle back to this.

I previously had only tested it on the Windows and Linux machines that are accessible to me and was unable to reproduce the bug there. I finally tried it on macOS and sure enough I can reproduce the bug, as well as your finding that it doesn't occur with Arduino IDE 1.x.

I did some investigation. When I run the locale command from a terminal on the macOS machine, I get the expected output:

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

Then I modified the boards platform to run the locale command as part of the compilation process by adding the following "pre-build hook" line to ~/Library/Arduino15/packages/adafruit/hardware/nrf52/1.3.0/platform.txt (you can actually add it to the platform.txt of any boards platform; there is nothing special about this specific platform in this regard):

recipe.hooks.prebuild.1.pattern=locale

After that modification, when I compile for a board of that platform, the locale command is executed as part of the compilation process and the following is printed in the Arduino IDE 2.0.0 verbose compilation output:

LANG=""
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

When I do the same on my Windows and Linux machines, the locale output is just the same whether it is executed from a terminal or from the compilation process.

When I do the same using an arduino-cli compile command from the command line on macOS, I get the identical output as I did from the terminal.

When I do the same using Arduino IDE 1.8.19, the output is similar to what I got from Arduino IDE 2.0.0:

LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

The difference is that LC_CTYPE is set to "C" in the 2.0.0 output and set to "UTF-8" in the 1.8.19 output.

@exipilis

This comment was marked as off-topic.

@per1234

This comment was marked as off-topic.

@ghost

This comment was marked as off-topic.

@DetErMadsHansen

This comment was marked as off-topic.

@exipilis

This comment was marked as off-topic.

@tinxx

This comment was marked as off-topic.

@per1234 per1234 added os: macos Specific to macOS operating system and removed conclusion: off topic Off topic for this repository labels Dec 30, 2022
@ApolloDS
Copy link

I think this is a bug which is described here:
Unicode/locale error on MacOS and Arduino 2.0.0 #743

@panjekm

This comment was marked as off-topic.

@myst729

This comment was marked as off-topic.

@tinxx

This comment was marked as off-topic.

@zeelodro62

This comment was marked as off-topic.

@zeelodro62

This comment was marked as off-topic.

@maxxafari

This comment was marked as off-topic.

@zeelodro62

This comment was marked as off-topic.

@arduino arduino locked as too heated and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
os: macos Specific to macOS operating system type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

9 participants