diff -r d698d34baf9b -r 58de33c1af03 src/NullByteHandler.h --- a/src/NullByteHandler.h Sat Apr 23 11:31:30 2022 +0200 +++ b/src/NullByteHandler.h Sat Apr 23 11:52:41 2022 +0200 @@ -29,6 +29,8 @@ #include #include +#include "Configuration.h" + namespace relpipe { namespace out { namespace nullbyte { @@ -40,10 +42,12 @@ class NullByteHandler : public RelationalReaderStringHandler { private: std::ostream& output; - std::wstring_convert> convertor; // TODO: support also other encodings. + std::wstring_convert> convertor; // TODO: support also other encodings? + Configuration configuration; + std::string nullByteReplacement; public: - NullByteHandler(std::ostream& output) : output(output) { + NullByteHandler(Configuration configuration, std::ostream& output) : configuration(configuration), output(output), nullByteReplacement(convertor.to_bytes(configuration.nullByteReplacement)) { } void startRelation(string_t name, std::vector attributes) override { @@ -54,7 +58,7 @@ const std::string octets = convertor.to_bytes(value); for (char ch : octets) { if (ch) output.put(ch); - else output.put('@'); // TODO: configurable replacement, maybe a string instead of a single char + else output << nullByteReplacement; } output.put(0); }