diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index ba76ad559b78c4afd4dc8013bf9ed344db8d416a..c4ada39e3fc554f787cc8792d03e8370913a2054 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -1230,7 +1230,14 @@ void LLSDFormatter::boolalpha(bool alpha)
 
 void LLSDFormatter::realFormat(const std::string& format)
 {
-	mRealFormat = format;
+    if(!format.empty())
+    {
+        mRealFormat = absl::ParsedFormat<absl::FormatConversionCharSet::kFloating>::New(format);
+        if(!mRealFormat)
+        {
+            LL_WARNS() << "Invalid real format spec: " << format << LL_ENDL;
+        }
+    }
 }
 
 S32 LLSDFormatter::format(const LLSD& data, std::ostream& ostr) const
@@ -1246,7 +1253,7 @@ S32 LLSDFormatter::format(const LLSD& data, std::ostream& ostr, EFormatterOption
 
 void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const
 {
-	ostr << absl::StreamFormat(mRealFormat.c_str(), real);
+	ostr << absl::StreamFormat(*mRealFormat, real);
 }
 
 /**
@@ -1354,7 +1361,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr,
 
 	case LLSD::TypeReal:
 		ostr << "r";
-		if(mRealFormat.empty())
+		if(!mRealFormat)
 		{
 			ostr << data.asReal();
 		}
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index b24ef9d9c477605278510a1f5936b9659a85af42..9702eca57336c0079aef237ac3a782197ac2593c 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -34,6 +34,8 @@
 #include "llrefcount.h"
 #include "llsd.h"
 
+#include "absl/strings/str_format.h"
+
 /** 
  * @class LLSDParser
  * @brief Abstract base class for LLSD parsers.
@@ -500,7 +502,7 @@ class LL_COMMON_API LLSDFormatter : public LLRefCount
 	void formatReal(LLSD::Real real, std::ostream& ostr) const;
 
 	bool mBoolAlpha;
-	std::string mRealFormat;
+    std::unique_ptr<absl::ParsedFormat<absl::FormatConversionCharSet::kFloating> > mRealFormat;
 	EFormatterOptions mOptions;
 };
 
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index 4a6a4a02fa699904cb6d0cdff347d22b32ffae7b..d7dab88e33c36e2b0914c733b97725b7bb7e3fb1 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -150,7 +150,7 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
 
 	case LLSD::TypeReal:
 		ostr << pre << "<real>";
-		if(mRealFormat.empty())
+		if(!mRealFormat)
 		{
 			ostr << data.asReal();
 		}