We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Operating system: Ubuntu 19.10
PlatformIO Version (platformio --version): PlatformIO, version 4.2.2a1
platformio --version
PlatformIO, version 4.2.2a1
pio run with python3 and python2 produce different binaries when source code contains strings with non-ASCII symbols.
pio run
main.ino
const char celsius[] = "-----> °C";
Checking that encoding is correct:
$ file src/main.ino src/main.ino: C source, UTF-8 Unicode text
Log from pio run:
Converting main.ino Unicode decode error has occurred, please remove invalid (non-ASCII or non-UTF8) characters from /home/builder/py2-test/src/main.ino.cpp file
Afterwards, checking firmware.elf. celcius string is stored as b0 43, which is invalid utf-8 sequence:
celcius
b0 43
$ xxd .pio/build/d1_mini/firmware.elf | grep -- '----->' 00001610: 2d2d 2d2d 2d3e 20b0 4300 0d0a 006e 616e -----> .C....nan ^^ ^^
This causes issues when strings are used as-is in, for example, WebSocket communication. See xoseperez/espurna#2163
Same version of PIO, but running with python3:
$ xxd .pio/build/d1_mini/firmware.elf | grep -- '----->' 00001610: 2d2d 2d2d 2d3e 20c2 b043 000d 0a00 6e61 -----> ..C....na ^^ ^^^^
The content of platformio.ini:
platformio.ini
[env:d1_mini] platform = espressif8266 board = d1_mini framework = arduino src_build_flags = -g
Source file to reproduce issue:
(main.ino) #include <Arduino.h> const char celsius[] = "-----> °C"; void setup() { Serial.begin(115200); Serial.println(celsius); } void loop() {}
Using PIO installed with Python 3 solves the issue.
Using .cpp or .h to store the string is a workaround. Raw bytes instead of strings is also a possible workaround.
The text was updated successfully, but these errors were encountered:
3a27fbc
Thanks for the report! Please re-test with pio upgrade --dev.
pio upgrade --dev
Sorry, something went wrong.
Can confirm that now it works with python2. Thank you!
No branches or pull requests
Configuration
Operating system:
Ubuntu 19.10
PlatformIO Version (
platformio --version
):PlatformIO, version 4.2.2a1
Description of problem
pio run
with python3 and python2 produce different binaries when source code contains strings with non-ASCII symbols.Steps to Reproduce
main.ino
in the project.const char celsius[] = "-----> °C";
and use it in the .ino fileActual Results
Checking that encoding is correct:
Log from
pio run
:Afterwards, checking firmware.elf.
celcius
string is stored asb0 43
, which is invalid utf-8 sequence:This causes issues when strings are used as-is in, for example, WebSocket communication.
See xoseperez/espurna#2163
Expected Results
Same version of PIO, but running with python3:
If problems with PlatformIO Build System:
The content of
platformio.ini
:Source file to reproduce issue:
Additional info
Using PIO installed with Python 3 solves the issue.
Using .cpp or .h to store the string is a workaround. Raw bytes instead of strings is also a possible workaround.
The text was updated successfully, but these errors were encountered: