diff --git a/IO/Legacy/vtkDataReader.cxx b/IO/Legacy/vtkDataReader.cxx
index d3e442c9bf9a1bca6711ea724717e713ff1ab0a8..342571a415bc39286cab0a8f2adf765fe7c34dfa 100644
--- a/IO/Legacy/vtkDataReader.cxx
+++ b/IO/Legacy/vtkDataReader.cxx
@@ -58,8 +58,8 @@
 
 #include <vtksys/SystemTools.hxx>
 
-#include <sstream>
 #include <cctype>
+#include <sstream>
 
 // I need a safe way to read a line of arbitrary length.  It exists on
 // some platforms but not others so I'm afraid I have to write it
@@ -447,6 +447,10 @@ size_t vtkDataReader::Peek(char *str, size_t n)
 // Open a vtk data file. Returns zero if error.
 int vtkDataReader::OpenVTKFile(const char* fname)
 {
+  // Save current locale settings and set standard one to
+  // avoid locale issues - for instance with the decimal separator.
+  this->CurrentLocale = std::locale::global(std::locale::classic());
+
   if(!fname && this->GetNumberOfFileNames() >0)
   {
     fname = this->GetFileName(0);
@@ -3417,6 +3421,10 @@ char *vtkDataReader::LowerCase(char *str, const size_t len)
 void vtkDataReader::CloseVTKFile()
 {
   vtkDebugMacro(<<"Closing vtk file");
+
+  // Restore the previous locale settings
+  std::locale::global(this->CurrentLocale);
+
   delete this->IS;
   this->IS = nullptr;
 }
diff --git a/IO/Legacy/vtkDataReader.h b/IO/Legacy/vtkDataReader.h
index 5450865e513f8960bfe7f5041b102857f134d824..4f14b3244e6035e4c9b64c660bd1e55d5ef19084 100644
--- a/IO/Legacy/vtkDataReader.h
+++ b/IO/Legacy/vtkDataReader.h
@@ -33,6 +33,8 @@
 #include "vtkSimpleReader.h"
 #include "vtkStdString.h" // For API using strings
 
+#include <locale> // For locale settings
+
 #define VTK_ASCII 1
 #define VTK_BINARY 2
 
@@ -554,6 +556,8 @@ protected:
   int FileMajorVersion;
   int FileMinorVersion;
 
+  std::locale CurrentLocale;
+
   void InitializeCharacteristics();
   int CharacterizeFile(); //read entire file, storing important characteristics
   void CheckFor(const char* name, char *line, int &num, char** &array,
diff --git a/IO/Legacy/vtkDataWriter.cxx b/IO/Legacy/vtkDataWriter.cxx
index 54b9ad5ddb1b9506772bc80714bae3780cd7893f..1b00fbf62d9cbf3ede214b8a297c6902e91d6b41 100644
--- a/IO/Legacy/vtkDataWriter.cxx
+++ b/IO/Legacy/vtkDataWriter.cxx
@@ -127,6 +127,10 @@ vtkDataWriter::~vtkDataWriter()
 // Open a vtk data file. Returns nullptr if error.
 ostream *vtkDataWriter::OpenVTKFile()
 {
+  // Save current locale settings and set standard one to
+  // avoid locale issues - for instance with the decimal separator.
+  this->CurrentLocale = std::locale::global(std::locale::classic());
+
   ostream *fptr;
 
   if ((!this->WriteToOutputString) && ( !this->FileName ))
@@ -2243,6 +2247,9 @@ void vtkDataWriter::CloseVTKFile(ostream *fp)
 {
   vtkDebugMacro(<<"Closing vtk file\n");
 
+  // Restore the previous locale settings
+  std::locale::global(this->CurrentLocale);
+
   if ( fp != nullptr )
   {
     if (this->WriteToOutputString)
diff --git a/IO/Legacy/vtkDataWriter.h b/IO/Legacy/vtkDataWriter.h
index ee612175f6da18bf859d3a6a6b815fc77d4159e6..3910bade0cc3dcc6ce5f49cb31d6373462aa6a20 100644
--- a/IO/Legacy/vtkDataWriter.h
+++ b/IO/Legacy/vtkDataWriter.h
@@ -32,6 +32,8 @@
 #include "vtkIOLegacyModule.h" // For export macro
 #include "vtkWriter.h"
 
+#include <locale> // For locale settings
+
 class vtkCellArray;
 class vtkDataArray;
 class vtkDataSet;
@@ -315,6 +317,8 @@ protected:
   char* PedigreeIdsName;
   char* EdgeFlagsName;
 
+  std::locale CurrentLocale;
+
   int WriteArray(ostream *fp, int dataType, vtkAbstractArray *data, const char *format,
                  vtkIdType num, vtkIdType numComp);
   int WriteScalarData(ostream *fp, vtkDataArray *s, vtkIdType num);