Skip to content

Commit

Permalink
vcf/io/writer/record/info/field/value/array: Percent-encode character…
Browse files Browse the repository at this point in the history
… values
  • Loading branch information
zaeleus committed Sep 12, 2024
1 parent 41f5d4e commit 1f71503
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions noodles-vcf/src/io/writer/record/info/field/value/array.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::io::{self, Write};

use super::write_character;
use crate::{io::writer::record::MISSING, variant::record::info::field::value::Array};

pub(super) fn write_array<W>(writer: &mut W, array: &Array) -> io::Result<()>
Expand Down Expand Up @@ -46,7 +47,7 @@ where
}

if let Some(c) = result? {
write!(writer, "{c}")?;
write_character(writer, c)?;
} else {
writer.write_all(MISSING)?;
}
Expand Down Expand Up @@ -104,7 +105,7 @@ mod tests {
t(&mut buf, &array, b"n")?;

let array = ArrayBuf::Character(vec![Some('n'), Some(':'), None]);
t(&mut buf, &array, b"n,:,.")?; // FIXME
t(&mut buf, &array, b"n,%3A,.")?;

let array = ArrayBuf::String(vec![Some(String::from("noodles"))]);
t(&mut buf, &array, b"noodles")?;
Expand Down

0 comments on commit 1f71503

Please sign in to comment.