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

Cyrillic characters in library name causes UnicodeEncodeError #3971

Closed
1 task done
maxgerhardt opened this issue Jun 13, 2021 · 2 comments
Closed
1 task done

Cyrillic characters in library name causes UnicodeEncodeError #3971

maxgerhardt opened this issue Jun 13, 2021 · 2 comments
Assignees
Labels
bug ldf Library Dependency Finder
Milestone

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Jun 13, 2021

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Windows 10 x64

PlatformIO Version (platformio --version): PlatformIO Core, version 5.2.0a6

Description of problem

Using a library with non-ASCII, e.g. cryllic characters, such as https://github.com/tremaru/iarduino_GSM, causes an excpetion upon PlatformIO printing the dependency tree.

Steps to Reproduce

  1. Clone reference project https://github.com/maxgerhardt/pio-crash-cyrillic
  2. Open it in VSCode
  3. Build it

Actual Results

Processing uno (platform: atmelavr; board: uno; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (3.3.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash   
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...    
Dependency Graph
UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-25: character maps to <undefined>:
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\main.py", line 178:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\atmelavr\builder\main.py", line 162:
    target_elf = env.BuildProgram()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\piolib.py", line 1075:
    _print_deps_tree(project)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\piolib.py", line 1042:
    click.echo("%s|-- %s" % (margin, title), nl=False)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\utils.py", line 272:
    file.write(message)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\_compat.py", line 710:
    return _write(s)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 41:
    self.__convertor.write(text)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\colorama\ansitowin32.py", line 164:
    self.wrapped.write(text)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 1379:
    self.file.write(arg)
  File "c:\users\max\appdata\local\programs\python\python38\lib\encodings\cp1252.py", line 19:
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
============================================================================================= [FAILED] Took 1.31 seconds =============================================================================================

Expected Results

Successfully build, which occurs when this

name =			iarduino GSM (сотовая связь)

is changed to

name =			iarduino GSM

If problems with PlatformIO Build System:

The content of platformio.ini:
See reference project
Source file to reproduce issue:
See reference project

Additional info

>pio system info
--------------------------  --------------------------------------------------------------------------
PlatformIO Core             5.2.0a6
Python                      3.8.6-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\Max\.platformio
PlatformIO Core Executable  C:\Users\Max\AppData\Local\Programs\Python\Python38\Scripts\platformio.exe
Python Executable           c:\users\max\appdata\local\programs\python\python38\python.exe
Global Libraries            0
Development Platforms       39
Tools & Toolchains          223
--------------------------  --------------------------------------------------------------------------
@maxgerhardt
Copy link
Contributor Author

maxgerhardt commented Jun 13, 2021

I've activated this Beta Windows setting and it changed my locale encoding to the UTF-8 codepage

Locale Encoding             cp65001

and building the project gives an impressive

grafik

success with the characters even being shown correctly.

So I'm not sure if this can be fixed in Python at all or Windows and the terminal is just really stupid with encodings...

@maxgerhardt maxgerhardt changed the title Cryllic characters in library name causes UnicodeEncodeError Cyrllic characters in library name causes UnicodeEncodeError Jun 13, 2021
@maxgerhardt maxgerhardt changed the title Cyrllic characters in library name causes UnicodeEncodeError Cyrillic characters in library name causes UnicodeEncodeError Jun 13, 2021
@ivankravets ivankravets added the ldf Library Dependency Finder label Sep 13, 2021
@ivankravets ivankravets self-assigned this Sep 13, 2021
@ivankravets ivankravets added this to the 5.2.1 milestone Sep 13, 2021
@ivankravets ivankravets modified the milestones: 5.2.1, 5.2.2 Oct 11, 2021
@ivankravets
Copy link
Member

Thanks for the report and provided project example! 😊

Please re-test with pio upgrade --dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ldf Library Dependency Finder
Projects
None yet
Development

No branches or pull requests

2 participants