From 155dd653e79487155d0bd6df18cd3714e8cf3bc9 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sat, 19 Sep 2015 16:23:09 +0200 Subject: [PATCH] Fixed `printTo(String)` which wrote numbers instead of strings (issue #120) --- CHANGELOG.md | 2 +- include/ArduinoJson/Internals/DynamicStringBuilder.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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; }