facebook / facebook/folly

unexpected character appear from method folly::toJson

Open
#1,494 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

- recreate step :

```
#include
#include
#include
#include
int main()
{
std::string str = "dev's work";
std::string sign = "\'\\\'\'";
boost::replace_all(str, "'", sign);
std::cout << str << std::endl;
folly::dynamic itemValue = folly::dynamic::object("value", str);
auto target = folly::toJson(itemValue);
std::cout << target << std::endl;
return 0;
}
```

`g++ -g test.cpp -o test -I/path/include -L/path/lib -lfolly`

```
$ ./test
dev'\''s work
{"value":"dev'\\''s work"}
```

- expected :
`{"value":"dev'\''s work"}`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.