<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Thanks for the advice,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My string were in utf-8 but were not displaying well even with cpg file. Setting the encoding for the layer did the trick. Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Even Rouault <even.rouault@spatialys.com> <br>
<b>Sent:</b> Thursday, August 12, 2021 12:24 PM<br>
<b>To:</b> Claudiu Cochior <Claudiu.Cochior@bentley.com>; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] unicode support in GDAL<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><i>WARNING: This email originated from outside of the organization. DO NOT click links, open attachments, or respond unless you recognize the sender and know the content is safe.</i><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Claudiu,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">OGR supports unicode strings, and expect/outputs in UTF-8 as the pivot encoding. See
<a href="https://urldefense.com/v3/__https:/gdal.org/development/rfc/rfc23_ogr_unicode.html__;!!F1Q1IbZmrAg!X0yQNxc3iWUObkK4uTo7AmP54lFFTXf-YBmMDpLLGuT-Gwb5bZlrK9YDMJNwbHjHQrf9cA$">
https://gdal.org/development/rfc/rfc23_ogr_unicode.html</a> for details<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">For shapefiles on writing, you'll need to pass the ENCODING=UTF-8 layer creation option (see
<a href="https://urldefense.com/v3/__https:/gdal.org/drivers/vector/shapefile.html*layer-creation-options__;Iw!!F1Q1IbZmrAg!X0yQNxc3iWUObkK4uTo7AmP54lFFTXf-YBmMDpLLGuT-Gwb5bZlrK9YDMJNwbHjfCK585w$">
https://gdal.org/drivers/vector/shapefile.html#layer-creation-options</a>), or at another value that is compatible of cyrillic characters (CP1251 e.g.)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Demo (in UTF-8 console)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">$ cat cyrillic.csv <br>
id,txt<br>
1,"Привет"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">$ ogr2ogr cyrillic.shp cyrillic.csv -lco ENCODING=CP1251<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">$ ogrinfo cyrillic.dbf -al -q<br>
<br>
Layer name: cyrillic<br>
Metadata:<br>
DBF_DATE_LAST_UPDATE=2021-08-12<br>
OGRFeature(cyrillic):0<br>
id (String) = 1<br>
txt (String) = Привет<br>
<br>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Even<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Le 12/08/2021 à 17:54, Claudiu Cochior via gdal-dev a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hello everybody,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I have a question related to Unicode strings in GDAL<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">We are using GDAL 3.0.4 and at some point we would like to write to shapefile a string that contains Russian characters. To give you some context, we are in C++, we created a OGRFeature and we want to set a field to the string that contains
the Russian characters. My machine is in English and the language for non-unicode programs is set to English. I didn’t find in the GDAL doc a definitive answer if GDAL support Unicode strings for filed values. As a test I converted the System::String to UTF-8
but the shape file displays only ? for the characters. If I change the language for non-unicode programs to Russian then I can safely extract the ANSI string and give it to the SetField method and the result is OK.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">So, does GDAL supports unicede field string values somehow?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks, <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Claudiu<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<p>This email, including any attachments, may contain confidential and/or proprietary information intended only for the use of the recipient. If you are not the intended recipient, any distribution, copying, or use of this email or its attachments is prohibited.
If you received this email in error, please reply to the sender immediately and delete this message and any copies.<o:p></o:p></p>
<p><i>Bentley Systems has taken all reasonable steps to ensure that this communication is free from viruses, data corruption, and unauthorized alteration. Bentley Systems does not accept liability for any damages that may be incurred as a result of this or
any communication by email</i><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="border:solid windowtext 1.0pt;padding:0in"><img border="0" width="100" height="100" style="width:1.0416in;height:1.0416in" id="Picture_x0020_3" src="cid:~WRD0001.jpg" alt="Image removed by sender."></span><o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>gdal-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://urldefense.com/v3/__https:/lists.osgeo.org/mailman/listinfo/gdal-dev__;!!F1Q1IbZmrAg!X0yQNxc3iWUObkK4uTo7AmP54lFFTXf-YBmMDpLLGuT-Gwb5bZlrK9YDMJNwbHiygVmSlw$">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="https://urldefense.com/v3/__http:/www.spatialys.com__;!!F1Q1IbZmrAg!X0yQNxc3iWUObkK4uTo7AmP54lFFTXf-YBmMDpLLGuT-Gwb5bZlrK9YDMJNwbHjxpaae3w$">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</div>
</body>
</html>