Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

umqtt.simple/umqtt/simple.py MQTTClient.publish() breaks on unicode

オープン
#1,073 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

@Josverl がすでに取り組んでいます。

2026年3月9日 から。

評価

この issue はまだ評価されていません。

説明

unicode

I've been looking over this for a couple of weeks, and I'm struggling to find the underlying issue.

On a live MQTT session (I'm running from a RP2040 to a Mosquitto server), a mq.publish with a unicode character will break the session, eventually resulting in a Errno 104 / ECONNRESET (presumably when the input buffer is full).

The more "obvious" way to observe it is to do a mosquitto_sub on the topic, and the publish method stops transmitting data.

To observe:

mosquitto_sub -h yourserver -t homeassistant/sensor/bedroom/# -v

From a micropython:

mq.publish('homeassistant/sensor/bedroom/mytest', 'F') # works fine
mq.publish('homeassistant/sensor/bedroom/mytest' '°F') # \u0080 followed by F, appears to work
mq.publish('homeassistant/sensor/bedroom/mytest', 'F') # no data is received

subsequent/enough further publish() calls will result in the ECONNRESET

Testing against mosquitto_pub with the same topic and unicode message indicate it all works.

Somehow I think the length calculation is thrown off by the string-vs-bytes-vs-unicode thing, but haven't been able to nail it down yet.

主要言語
Python
スター
2.9k
フォーク
1.1k
平均マージ
7日 4時間
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

micropython/micropython-lib のほかの issue

micropython/micropython-lib の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。