From 25b5e9fec1c28d94a4a05dd1825c1e0e3b171d6c Mon Sep 17 00:00:00 2001 From: jbeder Date: Sun, 26 Jul 2009 07:57:22 +0000 Subject: [PATCH] Fixed hex output in emitter (should be always two hex chars) --- src/emitterutils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp index 2fc6ad7..907e78c 100644 --- a/src/emitterutils.cpp +++ b/src/emitterutils.cpp @@ -2,8 +2,9 @@ #include "exp.h" #include "indentation.h" #include "exceptions.h" -#include #include "stringsource.h" +#include +#include namespace YAML { @@ -82,7 +83,7 @@ namespace YAML } else { // TODO: for the common escaped characters, give their usual symbol std::stringstream str; - str << "\\x" << std::hex << static_cast (ch); + str << "\\x" << std::hex << std::setfill('0') << std::setw(2) << static_cast (ch); out << str.str(); } }