BUG UnicodeReplacementConverter writes characters outside the BMP as invalid five-digit \u escapes
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
UnicodeReplacementConverterを読み、その出力を、issueによると期待されるサロゲートペアをすでに出力しているJsonStringConverterの出力と比較してください。提供されたPythonスニペットで絵文字を使って再現し、BMP文字の出力が現在のままであることを確認してください。非BMP文字が有効なUTF-16サロゲートペアとして表現され、再現結果を元のテキストにデコードできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
UnicodeReplacementConverter formats each character as \u{ord(ch):04x}. :04x is a minimum width, so a character outside the Basic Multilingual Plane (emoji, many CJK extension characters, math alphanumerics) gets five or six hex digits. A \u escape holds exactly four in JSON, JavaScript, Java and Python, so the output decodes to a different character followed by a stray digit.
To Reproduce
import asyncio, json
from pyrit.converter import UnicodeReplacementConverter
out = asyncio.run(UnicodeReplacementConverter().convert_async(prompt="hi 😀")).output_text
print(out) # hi ὠ0
print(json.loads(f'"{out}"')) # hi ὠ0
Expected behavior
😀 is written as its UTF-16 surrogate pair, 😀, which is what JsonStringConverter already emits for the same character. BMP characters keep their current output.
Version
main at 60c3386a, Python 3.11, Windows.
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 944
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 278
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG ColloquialWordswapConverter skips words next to punctuation and inserts spaces into hyphenated words対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
BUG: label queries only return the final conversation of an attack対応中かも @richlundeen が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/PyRIT#3095 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG PuzzledConverter cannot select words carrying non-ASCII letters, so the mask falls on articles instead対応中かも @adimalkar が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/PyRIT#3022 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG Configuration keeps runtime-status errors after polling recovers対応中かも @joeyvictorino が 1 日前に担当しました。 オープンBug: triage GUI help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
microsoft/PyRIT#2868 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG TokenBijectionConverter cannot represent a literal hyphen, so "e-mail" encodes identically to "email" and decodes without the hyphen対応中かも @kushaltalati が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
microsoft/PyRIT#3128 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
comp/gateway comp/plugins duplicate P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NousResearch/hermes-agent#137019 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: docs triaged
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
new-entry
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BinWang28/audio-ai-hub#194 ·
-
confluence: a paged listing's links re-encode a parameter they carry, where real carries it as sentオープンfidelity
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信