From d24f5d61e5fb2259e42afde7d0b86643846dc592 Mon Sep 17 00:00:00 2001
From: janestar <janestar92@163.com>
Date: Tue, 6 Dec 2016 18:05:40 +0800
Subject: [PATCH] BUG: mantis-1318 fix GDAL UTF-8 on Windows

---
 Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
index 6eb7a346fd..ff29de09c3 100644
--- a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
+++ b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
@@ -53,6 +53,10 @@ GDALDriverManagerWrapper::~GDALDriverManagerWrapper()
 GDALDatasetWrapper::Pointer
 GDALDriverManagerWrapper::Open( std::string filename ) const
 {
+  // This GDAL config option is there to handle UTF-8 filenames on Windows
+  // It fixes mantis bug 1318 where images with filenames like 你好.tif could not be read on Windows
+  CPLSetConfigOption("GDAL_FILENAME_IS_UTF8","NO");
+
   GDALDatasetWrapper::Pointer datasetWrapper;
 
   if (boost::algorithm::starts_with(filename, "http://")
-- 
GitLab