diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d2d47c..ea513b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ArduinoJson: change log v5.0.3 ------ -* Nothing yet. +* Fixed `printTo(String)` which wrote numbers instead of strings (issue #120) v5.0.2 ------ diff --git a/include/ArduinoJson/Internals/DynamicStringBuilder.hpp b/include/ArduinoJson/Internals/DynamicStringBuilder.hpp index 255b6671..e5595982 100644 --- a/include/ArduinoJson/Internals/DynamicStringBuilder.hpp +++ b/include/ArduinoJson/Internals/DynamicStringBuilder.hpp @@ -18,7 +18,8 @@ class DynamicStringBuilder : public Print { DynamicStringBuilder(String &str) : _str(str) {} virtual size_t write(uint8_t c) { - _str += c; + // Need to cast to char, otherwise String will print a number (issue #120) + _str += static_cast(c); return 1; }