Save and read multiline text as-is

Aperta
#1,501 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
data

Direzione di ricerca

Start from the YAML::Literal manipulator and the emitter path that writes literal block scalars, then reproduce the problem with a small program that emits a string ending in several newlines and reads it back. Check how the trailing newlines are dropped on write and how a newline is added on read. Done means the round trip keeps the exact trailing newlines and the existing emitter and parser tests still pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I need to save text data to a YAML file exactly as it is, so that another program can subsequently read the file and transmit the data over the network without modification. At the same time, I need to maintain the YAML file's readability.

To preserve readability when saving the text data, I use the YAML::Literal manipulator.

The problem with this manipulator is that it strips all trailing newlines from the text, whereas I need to preserve them. Additionally, when reading the data back as a std::string, a newline character (\n) is appended to the end.

In other words, I need to save text data to YAML file exactly as is and be able to read it back exactly as is. Does yaml-cpp provide any mechanisms for this?

Lingua principale
C++
Stelle
6.1k
Fork
2.2k
Merge medio
22h 2m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jbeder/yaml-cpp

Tutte le issue di jbeder/yaml-cpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.