Control characters in run text are deleted on save, so Segment.BeginOffset and run boundaries shift after reload
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 54/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 3
- Fork
- 15
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sillsdev/liblcm
-
Saving run text that contains a lone (unpaired) surrogate throws in TsString normalizationForse già presa @johnml1135 l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
-
Text props: an unknown writing-system handle is saved as ws="", which no reader can loadForse già presa @johnml1135 l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
-
Text property XML: writer emits properties and values its own reader rejects (record fails to load)Forse già presa @johnml1135 l’ha presa 1 giorno fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
-
DeepWiki-found bugsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
Tutte le issue di sillsdev/liblcm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
BEagle1984/silverback#280 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
-
Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
PSAppDeployToolkit/PSAppDeployToolkit#2392 ·
I maintainer di solito rispondono entro 1 giorno
-
Playground selection bar: comes back after Apply or scrolling while focus is in the Markdown paneAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sillsdev/SIL.TextEditing#175 ·
I maintainer di solito rispondono entro 1 giorno
-
needs attention untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3666 ·
I maintainer di solito rispondono entro 3 giorni