length, substr, index and . count bytes, not characters, in a UTF-8 locale
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the byte-based string functions in interpreter/src/builtins.rs and the locale handling in lexer/src/locale_encoding.rs; then trace how regular expressions handle character positions. Check the existing tests for length, substr, index, and regex matching. Done means UTF-8 locales count characters and preserve valid UTF-8, while LC_ALL=C retains byte behavior.
索引モデルが issue の本文から書いたものです。
説明
In a UTF-8 locale, string functions and regexps treat each byte as a character:
$ echo héllo | awk '{print length($0), index($0, "l"), substr($0, 2, 1)}'
6 4 �
$ echo héllo | awk '/^.....$/ {print "five"}'
$ echo héllo | awk '{print toupper($0)}'
HéLLO
gawk 5.3.2 prints 5 3 é, five and HÉLLO. POSIX defines these in characters, and substr here cuts é in half, so the output is not valid UTF-8. With LC_ALL=C, gawk counts bytes too (6).
length, substr, index work on bytes in interpreter/src/builtins.rs, and the regex is byte based. The lexer already reads the locale for \u escapes (lexer/src/locale_encoding.rs), so the locale is known.
Is character semantics in a UTF-8 locale planned? I can send a PR for the string built-ins if you want it.
Checked on main 67e0816, LANG=en_US.UTF-8.
- 主要言語
- Rust
- スター
- 31
- フォーク
- 13
- 平均マージ
- 23時間 42分
- マージ済み PR(30日)
- 29
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/awk のほかの issue
-
bug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug crash gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
awk: `-f missing-file` and `--source` panic対応中かも @VanshajPoonia が 4 日前に担当しました。 オープンbug crash gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
code-quality parser
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
eventflux-io/eventflux#218 ·
メンテナーはふだん 1 日以内に返信
-
StartSso docs say an option requires the built-in AuthnRequest renderer, which is now the only oneオープンdocumentation needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
marketing
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信