Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from sourcegraph/nsc/fixutf8
Browse files Browse the repository at this point in the history
Added check for invalid utf8 doc string and cleaning of invalid ones
  • Loading branch information
Strum355 authored Nov 18, 2020
2 parents 5184e3a + 12aa875 commit 0f8305e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index/LSIFSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ void writeHoverResult(LSIFMeta &Meta, const clang::clangd::Symbol &Sym,

JSONOut.attribute("value", OHover.str());
});
if (Sym.Documentation.data() && !Sym.Documentation.empty())
JSONOut.value(Sym.Documentation);
if (Sym.Documentation.data() && !Sym.Documentation.empty()) {
auto docString = Sym.Documentation;
if(!llvm::json::isUTF8(docString)) {
docString = llvm::StringRef(llvm::json::fixUTF8(Sym.Documentation));
}
JSONOut.value(docString);
}
});
});
});
Expand Down

0 comments on commit 0f8305e

Please sign in to comment.