length, substr, index and . count bytes, not characters, in a UTF-8 locale
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 31
- Forks
- 13
- Merge médio
- 23h 42min
- PRs com merge (30d)
- 29
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de uutils/awk
-
bug gnu-compat good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
bug crash gnu-compat good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
bug gnu-compat good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
bug gnu-compat good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
awk: `-f missing-file` and `--source` panicTalvez já em andamento @VanshajPoonia assumiu há 4 dias. Abertabug crash gnu-compat good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
Mantenedores costumam responder em até 1 dia
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 Meio dia Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
code-quality parser
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
eventflux-io/eventflux#218 ·
Mantenedores costumam responder em até 1 dia
-
StartSso docs say an option requires the built-in AuthnRequest renderer, which is now the only oneAbertadocumentation needs-triage
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
marketing
Dificuldade 2/5 Meio dia Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia