Skip to content

修复短 UTF-8 字段被误解析为 protobuf 的问题#40

Open
starmiaoa wants to merge 1 commit into
cwuom:mainfrom
starmiaoa:codex-pb-utf8-fix
Open

修复短 UTF-8 字段被误解析为 protobuf 的问题#40
starmiaoa wants to merge 1 commit into
cwuom:mainfrom
starmiaoa:codex-pb-utf8-fix

Conversation

@starmiaoa

@starmiaoa starmiaoa commented Jul 9, 2026

Copy link
Copy Markdown

概要

  • 保留短的、可读的 UTF-8 length-delimited 字段,避免它们被误判成 protobuf 子消息
  • 通过探测字段数量和 length-delimited 结构,尽量保留真正的嵌套 protobuf
  • 修复 fixed32/fixed64 字段的读写方式,避免回包时 wire type 被改坏
  • 字符串序列化时显式使用 UTF-8

背景

这个 PR 主要处理 #36 里提到的消息乱码问题:像 95ui。 这类短文本的字节序列有时会被当前解析逻辑误当成合法 protobuf,随后重新序列化成不同的字节,导致发送出去的内容在对方视角变成乱码或缺字。

@starmiaoa starmiaoa changed the title Fix accidental protobuf parsing of short UTF-8 fields 修复短 UTF-8 字段被误解析为 protobuf 的问题 Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant