yql_codec_results.cpp 551 B

12345678910111213141516171819202122232425
  1. #include "yql_codec_results.h"
  2. #include <library/cpp/string_utils/base64/base64.h>
  3. #include <yql/essentials/utils/utf8.h>
  4. namespace NYql {
  5. namespace NResult {
  6. constexpr TStringBuf TYsonResultWriter::VoidString;
  7. void TYsonResultWriter::OnStringScalar(TStringBuf value) {
  8. if (!IsUtf8(value)) {
  9. TString encoded = Base64Encode(value);
  10. Writer.OnBeginList();
  11. Writer.OnListItem();
  12. Writer.OnStringScalar(TStringBuf(encoded));
  13. Writer.OnEndList();
  14. } else {
  15. Writer.OnStringScalar(value);
  16. }
  17. }
  18. }
  19. }