<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Just to add a small note regarding OS X
(and iOS) and UTF-8 filenames: The HFS+ filesystem stores accented
characters in decomposed form, which can differ from the filename
given to an API that creates the file such as fopen(..., "wb").<br>
<br>
Applications that store a filename (e.g. into a preference or MRU
file) might store it in precomposed form, which won't match what
the filesystem uses and risks a file-not-found error. e.g. on iOS,
text input gives strings in precomposed form.<br>
<br>
More info is available at<br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/6153345/different-utf8-encoding-in-filenames-os-x">http://stackoverflow.com/questions/6153345/different-utf8-encoding-in-filenames-os-x</a><br>
<br>
Ray<br>
<br>
<br>
<br>
On 1/9/2017, Monday 2:03 AM, Damian Dixon wrote:<br>
</div>
<blockquote
cite="mid:CAJjdW1y4HcuptZ+w2DfyksvYsM+30GZidbSctx+u4zBcYimo6g@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">Hi Victor,</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">If you set GDAL_FILENAME_IS_UTF8 to YES then
you need to pass in filenames and paths encoded as UTF8.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">This means that on Windows you will need to do
additional work to convert from MBCS or UTF16/UCS2 to UTF8.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">If your application is built as MBCS then what
you essentially have is a multi-byte string encoding which is
the Windows local code page.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">If your application is built for Unicode then
you have UTF16/UCS2 so you have to convert the filenames to
UTF8 for GDAL/OGR to work.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">If you save the filenames as part of an
application specific configuration then you need to consider
how you will read read that data back in if the Windows code
page changes. This is not an easy task unless you also save
the code page as well. It also becomes a bit of a mess
supporting this on non-Windows.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">The approach we took was to convert our Windows
applications to Unicode and store/use all paths/filenames as
UTF8 for portability to Linux/Android/Solaris.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">Regards</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">Damian</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif">PS. Microsoft has deprecated MBCS build of MFC.</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:trebuchet
ms,sans-serif"><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 9 January 2017 at 09:31, Poughon
Victor <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:Victor.Poughon@cnes.fr" target="_blank">Victor.Poughon@cnes.fr</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
We are using GDAL in OTB and recently we had a bug report
about opening non<br>
ASCII filenames on Windows 10 [0]. They suggest a fix using:<br>
<br>
> CPLSetConfigOption("GDAL_<wbr>FILENAME_IS_UTF8","NO");<br>
<br>
The test case is GDALOpen() on a file named 你好.tif, which I
confirmed works<br>
fine on Linux, but not on Windows 7 or 10.<br>
<br>
So my question is to have some clarification on this option,
to know if it's<br>
potentially the correct fix for this problem. The doc says:<br>
<br>
> This effectively restores the pre-GDAL1.8 behavior for
handling filenames on<br>
> Windows and might be appropriate for applications that
treat filenames as<br>
> being in the local encoding.<br>
<br>
What does it mean exactly to consider filenames to be in the
local encoding? And<br>
how do I know if my application [1] does that?<br>
<br>
Cheers,<br>
<br>
[0] <a moz-do-not-send="true"
href="https://github.com/orfeotoolbox/OTB/pull/14"
rel="noreferrer" target="_blank">https://github.com/<wbr>orfeotoolbox/OTB/pull/14</a><br>
[1] <a moz-do-not-send="true"
href="https://github.com/janestar/OTB/blob/f6ffdc17ab3d7aa91726f03ed619fee806eb508a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx#L55"
rel="noreferrer" target="_blank">https://github.com/janestar/<wbr>OTB/blob/<wbr>f6ffdc17ab3d7aa91726f03ed619fe<wbr>e806eb508a/Modules/IO/IOGDAL/<wbr>src/<wbr>otbGDALDriverManagerWrapper.<wbr>cxx#L55</a><br>
<br>
Victor Poughon<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<p><br>
</p>
</body>
</html>