Commit 8675c0cd authored by Todd Martin's avatar Todd Martin

Utilise KWSYS ifstream and ofstream to properly handle UTF8 filenames

parent b3daa15d
......@@ -19,6 +19,7 @@
#include "vtkDebugLeaks.h"
#include <string>
#include <vtksys/FStream.hxx>
#include <vtksys/SystemTools.hxx>
void vtkSystemInformationPrintFile(const char* name, ostream& os)
......@@ -32,9 +33,9 @@ void vtkSystemInformationPrintFile(const char* name, ostream& os)
}
#ifdef _WIN32
ifstream fin(name, ios::in | ios::binary);
vtksys::ifstream fin(name, ios::in | ios::binary);
#else
ifstream fin(name, ios::in);
vtksys::ifstream fin(name, ios::in);
#endif
if (fin)
......
......@@ -15,6 +15,7 @@
#include "vtkXMLFileOutputWindow.h"
#include "vtkSmartPointer.h"
#include "vtksys/FStream.hxx"
#include <string>
int TestXMLFileOutputWindow(int argc, char* argv[])
......@@ -73,7 +74,7 @@ int TestXMLFileOutputWindow(int argc, char* argv[])
// Now, compare the default and specified files
// Read the default XML file
std::ifstream dfin("vtkMessageLog.xml");
vtksys::ifstream dfin("vtkMessageLog.xml");
std::string def((std::istreambuf_iterator<char>(dfin)), std::istreambuf_iterator<char>());
if (dfin.fail())
......@@ -82,7 +83,7 @@ int TestXMLFileOutputWindow(int argc, char* argv[])
return EXIT_FAILURE;
}
std::ifstream sfin(argv[1]);
vtksys::ifstream sfin(argv[1]);
std::string specified((std::istreambuf_iterator<char>(sfin)), std::istreambuf_iterator<char>());
if (sfin.fail())
......
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkFileOutputWindow.h"
#include "vtkObjectFactory.h"
#include "vtksys/FStream.hxx"
vtkStandardNewMacro(vtkFileOutputWindow);
......@@ -43,11 +44,20 @@ void vtkFileOutputWindow::Initialize()
}
if (this->Append)
{
#ifdef _WIN32
this->OStream =
new ofstream(vtksys::Encoding::ToWindowsExtendedPath(this->FileName), ios::app);
#else
this->OStream = new ofstream(this->FileName, ios::app);
#endif
}
else
{
#ifdef _WIN32
this->OStream = new ofstream(vtksys::Encoding::ToWindowsExtendedPath(this->FileName));
#else
this->OStream = new ofstream(this->FileName);
#endif
}
}
}
......
......@@ -347,14 +347,14 @@ bool vtkWin32OutputWindow::GetSendToStdErr()
void vtkWin32OutputWindow::SendToStdErrOn()
{
VTK_LEGACY_REPLACED_BODY(
vtkWin32OutputWindow::SendToStdErrOn, "VTK 8.3", vtkWin32OutputWindow::SetDisplayMode)
vtkWin32OutputWindow::SendToStdErrOn, "VTK 8.3", vtkWin32OutputWindow::SetDisplayMode);
this->SetDisplayMode(ALWAYS_STDERR);
}
void vtkWin32OutputWindow::SendToStdErrOff()
{
VTK_LEGACY_REPLACED_BODY(
vtkWin32OutputWindow::SendToStdErrOff, "VTK 8.3", vtkWin32OutputWindow::SetDisplayMode)
vtkWin32OutputWindow::SendToStdErrOff, "VTK 8.3", vtkWin32OutputWindow::SetDisplayMode);
this->SetDisplayMode(DEFAULT);
}
#endif
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkXMLFileOutputWindow.h"
#include "vtkObjectFactory.h"
#include "vtksys/Encoding.hxx"
vtkStandardNewMacro(vtkXMLFileOutputWindow);
......@@ -27,13 +28,23 @@ void vtkXMLFileOutputWindow::Initialize()
this->FileName = new char[strlen(fileName) + 1];
strcpy(this->FileName, fileName);
}
if (this->Append)
{
#ifdef _WIN32
this->OStream =
new ofstream(vtksys::Encoding::ToWindowsExtendedPath(this->FileName), ios::app);
#else
this->OStream = new ofstream(this->FileName, ios::app);
#endif
}
else
{
#ifdef _WIN32
this->OStream = new ofstream(vtksys::Encoding::ToWindowsExtendedPath(this->FileName));
#else
this->OStream = new ofstream(this->FileName);
#endif
this->DisplayTag("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
}
}
......
......@@ -21,6 +21,7 @@
using std::istringstream;
using std::ostringstream;
#include <string>
#include <vtksys/FStream.hxx>>
#include <vtksys/SystemTools.hxx>
using std::string;
#include <locale> // C++ locale
......@@ -442,7 +443,7 @@ void vtkXMLDataElement::PrintWithEscapedData(ostream& os, const char* data)
//----------------------------------------------------------------------------
void vtkXMLDataElement::PrintXML(const char* fname)
{
ofstream of(fname);
vtksys::ofstream of(fname);
of.imbue(std::locale::classic());
this->PrintXML(of, vtkIndent());
}
......
......@@ -25,6 +25,7 @@
#include "vtkTimerLog.h"
#include "vtkMath.h"
#include "vtksys/FStream.hxx"
#include <algorithm>
#include <cassert>
......@@ -545,7 +546,7 @@ void vtkTimerLog::DumpLogWithIndentsAndPercentages(std::ostream* os)
void vtkTimerLog::DumpLog(const char* filename)
{
#ifndef _WIN32_WCE
ofstream os_with_warning_C4701(filename);
vtksys::ofstream os_with_warning_C4701(filename);
int i;
if (vtkTimerLog::WrapFlag)
......
......@@ -19,7 +19,7 @@
int GenerateBlueObeliskHeader(int, char*[])
{
std::ifstream xml(VTK_BODR_DATA_PATH_BUILD "/elements.xml");
vtksys::ifstream xml(VTK_BODR_DATA_PATH_BUILD "/elements.xml");
if (!xml)
{
std::cerr << "Error opening file " VTK_BODR_DATA_PATH_BUILD "/elements.xml.\n";
......
......@@ -29,6 +29,7 @@
#include "vtkSimpleBondPerceiver.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkTransform.h"
#include "vtksys/FStream.hxx"
#include <fstream>
#include <iostream>
......@@ -94,7 +95,7 @@ int vtkGaussianCubeReader2::RequestInformation(vtkInformation* vtkNotUsed(reques
return 0;
}
ifstream file_in(this->FileName);
vtksys::ifstream file_in(this->FileName);
if (!file_in.is_open())
{
......@@ -169,7 +170,7 @@ int vtkGaussianCubeReader2::RequestData(
return 0;
}
ifstream file_in(this->FileName);
vtksys::ifstream file_in(this->FileName);
if (!file_in.is_open())
{
......
......@@ -25,6 +25,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkVectorOperators.h"
#include <vtksys/FStream.hxx>
#include <vtksys/RegularExpression.hxx>
#include <algorithm>
......@@ -102,7 +103,7 @@ int vtkVASPAnimationReader::RequestData(
vtkMolecule* output = vtkMolecule::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
assert(output);
std::ifstream in(this->FileName);
vtksys::ifstream in(this->FileName);
if (!in)
{
vtkErrorMacro("Could not open file for reading: " << (this->FileName ? this->FileName : ""));
......@@ -138,7 +139,7 @@ int vtkVASPAnimationReader::RequestData(
int vtkVASPAnimationReader::RequestInformation(
vtkInformation*, vtkInformationVector**, vtkInformationVector* outInfos)
{
std::ifstream in(this->FileName);
vtksys::ifstream in(this->FileName);
if (!in)
{
vtkErrorMacro("Could not open file for reading: " << (this->FileName ? this->FileName : ""));
......
......@@ -34,6 +34,7 @@
#include "vtkVector.h"
#include "vtkVectorOperators.h"
#include "vtksys/FStream.hxx"
#include <vtksys/RegularExpression.hxx>
#include <algorithm>
......@@ -175,7 +176,7 @@ int vtkVASPTessellationReader::RequestData(
vtkUnstructuredGrid::SafeDownCast(outInfo1->Get(vtkDataObject::DATA_OBJECT()));
assert(voronoi);
std::ifstream in(this->FileName);
vtksys::ifstream in(this->FileName);
if (!in)
{
vtkErrorMacro("Could not open file for reading: " << (this->FileName ? this->FileName : ""));
......@@ -213,7 +214,7 @@ int vtkVASPTessellationReader::RequestData(
int vtkVASPTessellationReader::RequestInformation(
vtkInformation*, vtkInformationVector**, vtkInformationVector* outInfos)
{
std::ifstream in(this->FileName);
vtksys::ifstream in(this->FileName);
if (!in)
{
vtkErrorMacro("Could not open file for reading: " << (this->FileName ? this->FileName : ""));
......
......@@ -23,6 +23,7 @@
#include "vtkPeriodicTable.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtksys/FStream.hxx"
#include <cmath>
#include <cstring>
......@@ -68,7 +69,7 @@ int vtkXYZMolReader2::RequestInformation(vtkInformation* vtkNotUsed(request),
return 0;
}
ifstream file_in(this->FileName);
vtksys::ifstream file_in(this->FileName);
if (!file_in.is_open())
{
......@@ -157,7 +158,7 @@ int vtkXYZMolReader2::RequestData(
return 0;
}
ifstream file_in(this->FileName);
vtksys::ifstream file_in(this->FileName);
if (!file_in.is_open())
{
......
......@@ -237,7 +237,7 @@ int main(int argc, char* argv[])
commandLine.push_back(nullptr);
filename += ".csv";
std::ofstream outfile(filename.c_str());
vtksys::ofstream outfile(filename.c_str());
// create and run the subprocess
vtksysProcess* process = vtksysProcess_New();
......
......@@ -29,6 +29,7 @@
#include "vtkSmartPointer.h"
#include "vtkUnsignedIntArray.h"
#include <vtksys/FStream.hxx>
#include <vtksys/SystemTools.hxx>
#include <sstream>
......@@ -101,7 +102,7 @@ int vtkFacetReader::CanReadFile(const char* filename)
return 0;
}
ifstream ifs(filename, ios::in);
vtksys::ifstream ifs(filename, ios::in);
if (!ifs)
{
// Specified filename not found
......@@ -144,7 +145,7 @@ int vtkFacetReader::RequestData(vtkInformation* vtkNotUsed(request),
return 1;
}
ifstream ifs(this->FileName, ios::in);
vtksys::ifstream ifs(this->FileName, ios::in);
if (!ifs)
{
this->SetErrorCode(vtkErrorCode::FileNotFoundError);
......
......@@ -28,6 +28,7 @@
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtksys/FStream.hxx"
vtkStandardNewMacro(vtkPipelineSize);
......@@ -62,12 +63,12 @@ void vtkPipelineSize::ComputeSourcePipelineSize(
// handle vtkDataReader subclasses
if (src->IsA("vtkDataReader"))
{
ifstream* ifs;
vtksys::ifstream* ifs;
vtkDataReader* rdr = vtkDataReader::SafeDownCast(src);
#ifdef _WIN32
ifs = new ifstream(rdr->GetFileName(), ios::in | ios::binary);
ifs = new vtksys::ifstream(rdr->GetFileName(), ios::in | ios::binary);
#else
ifs = new ifstream(rdr->GetFileName(), ios::in);
ifs = new vtksys::ifstream(rdr->GetFileName(), ios::in);
#endif
if (!ifs->fail())
{
......
......@@ -144,7 +144,7 @@ void vtkPStructuredGridConnectivity::CreateGhostLayers(const int N)
// BEGIN DEBUG
// std::ostringstream oss;
// oss << "Process" << this->Rank << "-neis.log";
// std::ofstream ofs;
// vtksys::ofstream ofs;
// ofs.open( oss.str().c_str() );
// assert("ERROR: cannot write log file" && ofs.is_open() );
// this->Print( ofs );
......@@ -1188,7 +1188,7 @@ void vtkPStructuredGridConnectivity::SerializeGhostData(const int sendGridID, co
// BEGIN DEBUG
// std::ostringstream oss;
// oss << "SendLog_" << this->Rank << ".txt";
// std::ofstream ofs;
// vtksys::ofstream ofs;
// ofs.open( oss.str().c_str() );
// ofs << "SEND MESSAGE SIZE: " << size << "\n";
// ofs << sendGridID << " " << rcvGrid << std::endl;
......@@ -1232,7 +1232,7 @@ void vtkPStructuredGridConnectivity::DeserializeGhostData(const int gridID, cons
// BEGIN DEBUG
// std::ostringstream oss;
// oss << "RcvLog_" << this->Rank << ".txt";
// std::ofstream ofs;
// vtksys::ofstream ofs;
// ofs.open( oss.str().c_str() );
// ofs << "RCV MESSAGE SIZE: " << size << "\n";
// ofs << remoteGrid << " " << rcvGrid << std::endl;
......@@ -1250,7 +1250,7 @@ void vtkPStructuredGridConnectivity::DeserializeGhostData(const int gridID, cons
// std::ostringstream oss;
// oss << "Extents-" << this->Rank << "-" << neiGridIdx << ".txt";
// std::ofstream ofs;
// vtksys::ofstream ofs;
// ofs.open( oss.str().c_str() );
// assert( ofs.is_open() );
//
......
......@@ -72,7 +72,7 @@ int CalculateProcessorRank(int* procDim, int* procId)
// Read a block of data bounded by [low, high] from file into buffer.
// The entire data has dimensions dim
int ReadFloatDataBlockFromFile(ifstream& ifs, int* dim, int* low, int* high, float* buffer)
int ReadFloatDataBlockFromFile(istream& ifs, int* dim, int* low, int* high, float* buffer)
{
vtkIdType dimXY = dim[0] * dim[1];
vtkIdType dimX = dim[0];
......@@ -145,8 +145,8 @@ int ReadFloatDataBlockFromFile(ifstream& ifs, int* dim, int* low, int* high, flo
// Given the data dimensions dataDim, the process dimensions procDim, my
// process id myProcId, set the block bounding box myBlockBounds for my data.
// Also open the data file as filestream ifs.
int SetDataParameters(int* dataDim, int* procDim, int* myProcId, const char* fileName,
ifstream& ifs, int myBlockBounds[2][3])
int SetDataParameters(int* dataDim, int* procDim, int* myProcId, const char* fileName, istream& ifs,
int myBlockBounds[2][3])
{
vtkIdType myDim[3];
myDim[0] = static_cast<int>(ceil(dataDim[0] / (1. * procDim[0])));
......@@ -198,7 +198,7 @@ void RealDataDescriptiveStatistics(vtkMultiProcessController* controller, void*
timer->StartTimer();
// ************************** Read input data file ****************************
ifstream ifs;
vtksys::ifstream ifs;
int myBlockBounds[2][3];
if (SetDataParameters(args->dataDim, args->procDim, myProcId, args->fileName, ifs, myBlockBounds))
{
......
......@@ -301,7 +301,7 @@ void WriteBPFile3DVars(const std::string& fileName, const size_t steps, const in
? fileName + "/vtk.xml"
: fileName + ".dir/vtk.xml";
std::ofstream fxml(vtkFileName, ofstream::out);
vtksys::ofstream fxml(vtkFileName, vtksys::ofstream::out);
fxml << unstructureGridSchema << "\n";
fxml.close();
}
......
......@@ -251,7 +251,7 @@ types::DataSet XMLInitDataSet(
std::string FileToString(const std::string& fileName)
{
std::ifstream file(fileName);
vtksys::ifstream file(fileName);
std::stringstream schemaSS;
schemaSS << file.rdbuf();
return schemaSS.str();
......
......@@ -22,6 +22,7 @@
#include "vtkOverlappingAMR.h"
#include "vtkPolyData.h"
#include "vtkUniformGrid.h"
#include "vtksys/FStream.hxx"
#include "vtksys/SystemTools.hxx"
#include "vtkCellData.h"
......@@ -182,7 +183,7 @@ void vtkAMREnzoReader::ParseConversionFactors()
baseDir + "/" + vtksys::SystemTools::GetFilenameWithoutExtension(std::string(this->FileName));
// STEP 1: Open Parameters file
std::ifstream ifs;
vtksys::ifstream ifs;
ifs.open(paramsFile.c_str());
if (!ifs.is_open())
{
......
......@@ -31,6 +31,7 @@
#include "vtkUnsignedCharArray.h"
#include "vtkUnsignedIntArray.h"
#include "vtkUnsignedShortArray.h"
#include "vtksys/FStream.hxx"
#include "vtksys/SystemTools.hxx"
// ----------------------------------------------------------------------------
......@@ -586,7 +587,7 @@ int vtkEnzoReaderInternal::LoadAttribute(const char* attribute, int blockIdx)
// block file name, and particle file name of each block
void vtkEnzoReaderInternal::ReadBlockStructures()
{
ifstream stream(this->HierarchyFileName.c_str());
vtksys::ifstream stream(this->HierarchyFileName.c_str());
if (!stream)
{
vtkGenericWarningMacro(
......@@ -815,7 +816,7 @@ void vtkEnzoReaderInternal::ReadBlockStructures()
// obtain the general information of the dataset (number of dimensions)
void vtkEnzoReaderInternal::ReadGeneralParameters()
{
ifstream stream(this->MajorFileName.c_str());
vtksys::ifstream stream(this->MajorFileName.c_str());
if (!stream)
{
vtkGenericWarningMacro("Invalid parameter file " << this->MajorFileName.c_str() << endl);
......
......@@ -24,13 +24,14 @@
#include <sstream>
#include <vector>
#include <vtksys/FStream.hxx>
namespace
{
std::string ReadFile(const std::string& filename)
{
std::string contents;
std::ifstream stream(filename, std::ios::binary);
vtksys::ifstream stream(filename.c_str(), std::ios::binary);
if (stream)
{
stream.seekg(0, std::ios::end);
......
......@@ -29,6 +29,7 @@
#include "vtkPolyData.h"
#include "vtkSOADataArrayTemplate.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtksys/FStream.hxx"
#include "vtksys/SystemTools.hxx"
#include <algorithm>
......@@ -49,7 +50,7 @@ std::string ReadAndBroadCastFile(const std::string& filename, vtkMultiProcessCon
std::string contents;
if (controller == nullptr || controller->GetLocalProcessId() == 0)
{
std::ifstream stream(filename, std::ios::binary);
vtksys::ifstream stream(filename.c_str(), std::ios::binary);
if (stream)
{
stream.seekg(0, std::ios::end);
......@@ -531,7 +532,7 @@ public:
const std::string& fname =
this->GetDATAFileName(self->PlotFileName, self->ParticleType, level, gridInfo.which);
std::ifstream ifp(fname, std::ios::binary);
vtksys::ifstream ifp(fname.c_str(), std::ios::binary);
if (!ifp.good())
{
return false;
......@@ -648,7 +649,7 @@ int vtkAMReXParticlesReader::CanReadFile(const char* fname, const char* particle
const std::string header(particles + "/Header");
if (vtksystools::FileExists(header, /*isFile*/ true))
{
std::ifstream ifp(header.c_str(), std::ios::binary);
vtksys::ifstream ifp(header.c_str(), std::ios::binary);
if (ifp)
{
std::string header_line;
......
......@@ -30,6 +30,7 @@
#include "vtkUnsignedCharArray.h"
#include "vtkXMLImageDataWriter.h"
#include "vtkZLibDataCompressor.h"
#include "vtksys/FStream.hxx"
#include <cassert>
#include <cmath>
......@@ -56,7 +57,7 @@ static void EncodeAndWrite(const vtkSmartPointer<vtkImageData>& image, const std
size_t bufSize = image->GetNumberOfPoints() * sizeof(float);
unsigned char* cBuffer = new unsigned char[bufSize];
size_t compressSize = zLib->Compress((unsigned char*)zBuf, bufSize, cBuffer, bufSize);
ofstream fileHandler(fileName.c_str(), ios::out | ios::binary);
vtksys::ofstream fileHandler(fileName.c_str(), ios::out | ios::binary);
fileHandler.write((const char*)cBuffer, compressSize);
delete[] cBuffer;
}
......@@ -115,7 +116,7 @@ static void EncodeAndWrite(const vtkSmartPointer<vtkImageData>& image, const std
int scalarSize = scalars->GetDataTypeSize();
const char* scalarPtr = static_cast<const char*>(scalars->GetVoidPointer(0));
size_t numberOfScalars = image->GetNumberOfPoints();
ofstream fileHandler(fileName.c_str(), ios::out | ios::binary);
vtksys::ofstream fileHandler(fileName.c_str(), ios::out | ios::binary);
fileHandler.write(scalarPtr, numberOfScalars * scalarSize);
}
}
......
......@@ -23,6 +23,7 @@
#include "vtkArrayReader.h"
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
#include "vtksys/FStream.hxx"
#include <sstream>
#include <stdexcept>
......@@ -75,7 +76,7 @@ int vtkArrayDataReader::RequestData(
if (!this->FileName)
throw std::runtime_error("FileName not set.");
ifstream file(this->FileName, std::ios::binary);
vtksys::ifstream file(this->FileName, std::ios::binary);
array_data = this->Read(file);
}
......
......@@ -20,6 +20,7 @@
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
#include "vtksys/FStream.hxx"
#include <sstream>
#include <stdexcept>
......@@ -72,13 +73,13 @@ int vtkArrayDataWriter::Write()
bool vtkArrayDataWriter::Write(const vtkStdString& file_name, bool WriteBinary)
{
ofstream file(file_name.c_str(), std::ios::binary);
vtksys::ofstream file(file_name.c_str(), std::ios::binary);
return this->Write(file, WriteBinary);
}
bool vtkArrayDataWriter::Write(vtkArrayData* array, const vtkStdString& file_name, bool WriteBinary)
{
ofstream file(file_name.c_str(), std::ios::binary);
vtksys::ofstream file(file_name.c_str(), std::ios::binary);
return vtkArrayDataWriter::Write(array, file, WriteBinary);
}
......
......@@ -26,6 +26,7 @@
#include "vtkSmartPointer.h"
#include "vtkSparseArray.h"
#include "vtkUnicodeString.h"
#include "vtksys/FStream.hxx"
#include <sstream>
#include <stdexcept>
......@@ -529,7 +530,7 @@ int vtkArrayReader::RequestData(
if (!this->FileName)
throw std::runtime_error("FileName not set.");
ifstream file(this->FileName, std::ios::binary);
vtksys::ifstream file(this->FileName, std::ios::binary);
array = this->Read(file);
}
......
......@@ -23,6 +23,7 @@
#include "vtkSmartPointer.h"
#include "vtkSparseArray.h"
#include "vtkUnicodeString.h"
#include "vtksys/FStream.hxx"
#include <cmath>
#include <limits>
......@@ -371,13 +372,13 @@ int vtkArrayWriter::Write()
bool vtkArrayWriter::Write(const vtkStdString& file_name, bool WriteBinary)
{
ofstream file(file_name.c_str(), std::ios::binary);
vtksys::ofstream file(file_name.c_str(), std::ios::binary);
return this->Write(file, WriteBinary);
}
bool vtkArrayWriter::Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary)
{
ofstream file(file_name.c_str(), std::ios::binary);
vtksys::ofstream file(file_name.c_str(), std::ios::binary);
return vtkArrayWriter::Write(array, file, WriteBinary);
}
......
......@@ -29,6 +29,7 @@
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
#include "vtkTable.h"
#include "vtksys/FStream.hxx"
#include <sstream>
#include <vector>
......@@ -83,7 +84,7 @@ bool vtkDelimitedTextWriter::OpenStream()
vtkDebugMacro(<< "Opening file for writing...");
ofstream* fptr = new ofstream(this->FileName, ios::out);
vtksys::ofstream* fptr = new vtksys::ofstream(this->FileName, ios::out);
if (fptr->fail())
{
......
......@@ -30,6 +30,7 @@
#include "vtkSmartPointer.h"
#include "vtkStringArray.h"
#include "vtkTable.h"
#include "vtksys/Encoding.hxx"
#include <sstream>
#include <vector>
......@@ -83,7 +84,11 @@ ofstream* vtkJavaScriptDataWriter::OpenFile()
vtkDebugMacro(<< "Opening file for writing...");
#ifdef _WIN32
ofstream* fptr = new ofstream(vtksys::Encoding::ToWindowsExtendedPath(this->FileName), ios::out);
#else
ofstream* fptr = new ofstream(this->FileName, ios::out);
#endif
if (fptr->fail())
{
......
......@@ -28,6 +28,7 @@
#include "vtkStructuredGrid.h"
#include "vtkStructuredPoints.h"
#include "vtkUnstructuredGrid.h"
#include "vtksys/Encoding.hxx"
#include <cctype>
#include <string>
......@@ -108,7 +109,8 @@ int vtkEnSight6BinaryReader::OpenFile(const char* filename)
this->FileSize = static_cast<vtkTypeUInt64>(fs.st_size);
#ifdef _WIN32
this->BinaryIFile = new ifstream(filename, ios::in | ios::binary);
this->BinaryIFile =
new ifstream(vtksys::Encoding::ToWindowsExtendedPath(filename), ios::in | ios::binary);
#else
this->BinaryIFile = new ifstream(filename, ios::in);
#endif
......