Control characters in run text are deleted on save, so Segment.BeginOffset and run boundaries shift after reload
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 54/100
Línea de trabajo
Start by reading StripInvalidXmlChars in TsStringSerializer and TsStringUtils.NormalizeNfd(ITsString), then compare the suggested behavior with #414. Run the named ControlCharacterOffsetDesyncTests and the TsStringSerializerTests round-trip to confirm the offset shift. Done means serialization and normalization preserve text length by replacing invalid XML characters with U+FFFD, or the chosen input policy is covered by tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Characters XML cannot store (U+0000–U+0008, U+000B, U+000C, U+000E–U+001F, U+FFFE, U+FFFF) are accepted by the model, but TsStringSerializer silently deletes them on write (StripInvalidXmlChars). After reload, anything that stores a character index into the text points at the wrong character.
Repro (master 0bc98fb0, net462 and net8.0):
- Take a paragraph
One a<U+0001>b two. Three four.whose second segment hasBeginOffset13 ("Three"). Save, close and reopen the project. The text is now 23 characters instead of 24, andBeginOffset13 points at "hree ". The next parse or edit misplaces analyses. - The same happens with a plain string: runs
ab<U+0001>cd(en) +EFGH(es) serialize and deserialize with the es run starting at 4 instead of 5.
ktptOffset is not affected: it is a baseline shift in millipoints, not a character index.
Suggested fix: make writes length-preserving by replacing these characters with U+FFFD instead of deleting them, and apply the same replacement at input in TsStringUtils.NormalizeNfd(ITsString). This is the approach #414 takes for lone surrogates. Whether to replace them or reject them at input is a maintainer decision. Failing tests are ready (ControlCharacterOffsetDesyncTests, and a TsStringSerializerTests round-trip) and can come with the fix PR.
Related: #409, #412, #414.
- Lenguaje dominante
- C#
- Estrellas
- 3
- Forks
- 15
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 sillsdev/liblcm
-
Saving run text that contains a lone (unpaired) surrogate throws in TsString normalizationPosiblemente ocupada @johnml1135 la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
-
Text props: an unknown writing-system handle is saved as ws="", which no reader can loadPosiblemente ocupada @johnml1135 la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
-
Text property XML: writer emits properties and values its own reader rejects (record fails to load)Posiblemente ocupada @johnml1135 la tomó hace 1 día. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
-
DeepWiki-found bugsAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Todos los issues de sillsdev/liblcm
Issues similares
-
needs-triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
Azure/azure-sdk-for-net#64658 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/aspnetcore#70370 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NethermindEth/nethermind#15684 ·
Los mantenedores suelen responder en 1 día
-
area/ai-assistant squad/flyt
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Altinn/altinn-studio#21798 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
SubtitleEdit/subtitleedit#16699 ·
Los mantenedores suelen responder en 1 día