← index #2497Issue #6912
Related · high · value 0.878
QUERY · ISSUE

ESP8266: WebREPL truncates pasted data

openby cpoppopened 2016-10-09updated 2023-12-07
port-esp8266

I'm running 1.8.4 and I notice that data pasted into the WebREPL is truncated.

Start up the WebREPL and trying pasting the following

"*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************"

The result is that only around 256 characters of what is pasted actually shows up. This is most troublesome when trying to use paste mode (CTRL-E) to bring in some existing code.

This might be related to the dupterm ringbuffer getting filled: https://github.com/micropython/micropython/blob/master/esp8266/esp_mphal.c#L39

CANDIDATE · ISSUE

Raw paste mode can't be used with WebREPL

openby aivarannamaaopened 2021-02-16updated 2025-08-26
bugunicode

Thonny users found that after upgrading MicroPython on their ESP8266 from 1.13 to 1.14, the WebREPL connection didn't work anymore (https://github.com/thonny/thonny/issues/1613).

Thonny first tries to communicate with the device in raw-paste mode, but this fails at websocket level when the device actually supports this mode. It looks like WebREPL is sending the window size increment as a text frame and this can produce a UnicodeDecodeError. Example stacktrace when using ESP8266:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 910, in read_message
    return frame.data.decode("utf-8") if text else frame.data
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

I didn't check the actual content and type of the websocket frames, but I've seen 0x80 as part of the window-size increment bytes before.

For now, I'm going to use regular paste mode with WebREPL connection, but it would be nice, if the more efficient raw-paste mode worked as well.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied