UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 251: character maps to <undefined>

Hi!
I am programming in esp-idf environment …
Why does such a line in the code lead to a compilation crash ??

    #include <string.h>
    .....
    char * istr = strtok (tmp, sep);

out:

    Building in release mode
    Compiling .pio\build\esp-wrover-kit\src\interface.o
    main\interface.c: In function 'checkCommand':
    Exception in thread Thread-3:
    Traceback (most recent call last):
      File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
        self.run()
      File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run
        self._target(*self._args, **self._kwargs)
      File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 46, in run
        self.do_reading()
      File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in do_reading
        for byte in iter(lambda: self._pipe_reader.read(1), ""):
      File "c:\users\alexander\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in <lambda>
        for byte in iter(lambda: self._pipe_reader.read(1), ""):
      File "C:\Users\Alexander\AppData\Local\Programs\Python\Python37\lib\encodings\cp1251.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 251: character maps to <undefined>

Your compiler does not know about char * strtok (char * str, const char * sep);?
It is sad …

Seems more like decoding the compile error message has caused some defect with weird characters from a different charset (cyrillic?). Can you provide the exact interface.c which causes the error?

1 Like

Sorry, I found the reason for the failure. :flushed: :flushed: :flushed:
I was very confused that without this “ill-fated” function of there were no errors. :face_with_monocle:
Sorry again. :pleading_face:

Could you try this branch ?

Thank you.
No free time to check.