yaml-cpp
yaml-cpp copied to clipboard
Having issue when reading string parameters
I am having issues with YAML::Load(file_name) command. String parameters are being converted to something different
For example
- type: "shelf"
becomes
- type: !<!> shelf
I am reading the yaml file as follows:
YAML::Node config = YAML::LoadFile("/home/ulas/test.yaml");
YAML::Emitter emit;
emit << config;
std::cout << "Initial \n"<<emit.c_str()<<std::endl;`
My yaml file looks like this
item_manager:
active_items:
- type: "shelf"
- type: "drawer"
params:
front_drawer:
color: 1.0
- type: "window"
params:
window:
height: 1.0
The output becomes
Initial
item_manager:
active_items:
- type: !<!> shelf
- params:
front_drawer:
color: 1.0
type: !<!> drawer
- type: !<!> window
params:
window:
height: 1.0
It occurs both in versions 0.5.2-4 and 0.7
This is surprising. I thought this was fixed in Issue #202 (d0250400496b6ac61f672bdad116c36c24383dd8). There's a test added that does:
Node n(Load("\"test\""));
out << n;
ExpectEmit("test");
I guess this is different because it's a map value? Super strange. PRs welcome.