<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<strong></strong>
<div class="moz-cite-prefix">Claudiu,</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">OGR supports unicode strings, and
expect/outputs in UTF-8 as the pivot encoding. See
<a class="moz-txt-link-freetext" href="https://gdal.org/development/rfc/rfc23_ogr_unicode.html">https://gdal.org/development/rfc/rfc23_ogr_unicode.html</a> for
details</div>
<div class="moz-cite-prefix">For shapefiles on writing, you'll need
to pass the ENCODING=UTF-8 layer creation option (see
<a class="moz-txt-link-freetext" href="https://gdal.org/drivers/vector/shapefile.html#layer-creation-options">https://gdal.org/drivers/vector/shapefile.html#layer-creation-options</a>),
or at another value that is compatible of cyrillic characters
(CP1251 e.g.)</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Demo (in UTF-8 console)</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">$ cat cyrillic.csv <br>
id,txt<br>
1,"Привет"<br>
<br>
</div>
<div class="moz-cite-prefix">$ ogr2ogr cyrillic.shp cyrillic.csv
-lco ENCODING=CP1251<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">$ 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>
<br>
</div>
<div class="moz-cite-prefix">Even<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Le 12/08/2021 à 17:54, Claudiu Cochior
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:DS7PR19MB45812F2486ED1BB76B5602A7E6F99@DS7PR19MB4581.namprd19.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@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;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}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]-->
<div class="WordSection1">
<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>
</div>
<br>
<hr>
<br>
<br>
<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.</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></p>
<br>
<p><img
src="https://cdn2.webdamdb.com/310th_sm_UnR3pO7k0ir0.jpg?1616176329"
moz-do-not-send="true" width="100"></p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-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="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>