length, substr, index and . count bytes, not characters, in a UTF-8 locale
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 31
- Forks
- 13
- Merge medio
- 23 h 42 min
- PR fusionados (30 d)
- 29
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de uutils/awk
-
bug gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug crash gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
awk: ARGV and ARGC are never setAbiertobug gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
awk: `-f missing-file` and `--source` panicPosiblemente ocupada @VanshajPoonia la tomó hace 4 días. Abiertobug crash gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
Todos los issues de uutils/awk
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
code-quality parser
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
eventflux-io/eventflux#218 ·
Los mantenedores suelen responder en 1 día
-
StartSso docs say an option requires the built-in AuthnRequest renderer, which is now the only oneAbiertodocumentation needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día