[gdal-dev] Could not write Japanese characters in Shapefiles

tor21sor at protonmail.com tor21sor at protonmail.com
Sun Jul 7 01:34:03 PDT 2019


Hi,

Great to find an awesome geospatial library!

I could read the field names of a shapefile in Japanese characters by applying the following setting in Python 3 program.
os.environ['SHAPE_ENCODING'] = "Shift_JIS"

fieldname = in_feature.GetField('Name')

However, I could not write the fieldnames in Japanese characters.
I tried as follows:

out_layer.CreateField(ogr.FieldDefn('Name', ogr.OFTString))
out_feature = ogr.Feature(out_layer.GetLayerDefn())

out_feature.SetField('Name', fieldname)
out_layer.CreateFeature(out_feature)

Japanese characters lost while reading the files wriiten with the above procedure.

I hope someone can assist me in this matter.
Thanks you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190707/2139e303/attachment.html>


More information about the gdal-dev mailing list