Opened 9 years ago

Closed 5 years ago

#5859 closed defect (wontfix)

C# bindings and UTF-8 characters

Reported by: zhulongxing Owned by: zhulongxing
Priority: normal Milestone: closed_because_of_github_migration
Component: CSharpBindings Version: 1.11.0
Severity: normal Keywords: chinese field
Cc: tamas

Description (last modified by zhulongxing)

Hello, I'm a new gdal user, and I want to use gdal library to read a ESRI File GDB format data, but looks like the gdal can't support chinese field... please see the details from attached, thanks~

Attachments (5)

chinese_field_problem.png (163.3 KB ) - added by zhulongxing 9 years ago.
testing.gdb.zip (30.5 KB ) - added by zhulongxing 9 years ago.
testing.gdb
chinese_field_problem_debug.png (190.2 KB ) - added by zhulongxing 9 years ago.
test-utf8.csv (85 bytes ) - added by Even Rouault 9 years ago.
CSV files with Chinese characters in UTF-8
test-utf-8_debug.png (186.6 KB ) - added by zhulongxing 9 years ago.

Download all attachments as: .zip

Change History (17)

by zhulongxing, 9 years ago

Attachment: chinese_field_problem.png added

comment:1 by zhulongxing, 9 years ago

Description: modified (diff)

comment:2 by Even Rouault, 9 years ago

Component: SWIG (all bindings)OGR_SF
Owner: changed from hobu to warmerdam
Priority: highnormal

Please attach the related file geodatabase or provide a link where it can be downloaded. Whith which software using GDAL did you see the truncation ? Do you know which driver has been used: FileGDB (using the ESRI SDK) or OpenFileGDB ?

by zhulongxing, 9 years ago

Attachment: testing.gdb.zip added

testing.gdb

in reply to:  2 comment:3 by zhulongxing, 9 years ago

Owner: changed from warmerdam to zhulongxing
Status: newassigned

Replying to rouault:

Please attach the related file geodatabase or provide a link where it can be downloaded. Whith which software using GDAL did you see the truncation ? Do you know which driver has been used: FileGDB (using the ESRI SDK) or OpenFileGDB ?

Dear, I'm using the ESRI ArcMap to view the data and do not see the truncation. I using the ESRI FileGDB SDK(FileGDB_API_VS2010_1_3) to read the gdb data. Attached are the testing.gdb for you reference, thanks~

comment:4 by Even Rouault, 9 years ago

Your report is not clear. You mention that you see truncation with GDAL. But how exactly ? With which utility / software did you make the left bottom part of your screenshot ?

"ogrinfo -al testing.gdb" with the FileGDB driver (based on ESRI FileGDB SDK) shows :

OGRFeature(DP_SZ_S_K20_WKCD2):1
  DP_SZID (String) = OU(ARVTSB)
  DP_ZID (String) = OU
  Name_E (String) = AIRPORT RAILWAY VENTILATION
  Name_C (String) = 機場鐵路通風及牽引配電站大樓
[...]
OGRFeature(DP_SZ_S_K20_WKCD2):2
  DP_SZID (String) = OU(WHCVB)
  DP_ZID (String) = OU
  Name_E (String) = WEST HARBOUR CROSSING VENTILATION
  Name_C (String) = 西區海底隧道通風塔
[...]

So apparently like the ArcMap screenshot.

comment:5 by zhulongxing, 9 years ago

I am using the C# bindings with GDAL/OGR to read the testing.gdb data. In vs2010 debug model, the value of Name_C field are missing some chars like attached chinese_field_problem.png, following are the code snippets:

Ogr.RegisterAll(); OSGeo.GDAL.Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");

DataSource ds = Ogr.Open("c:
testing.gdb", 0); Layer layer = ds.GetLayerByName("DP_SZ_S_K20_WKCD2");

string tableName = layer.GetName(); DataTable table = new DataTable(tableName);

FeatureDefn featDefn = layer.GetLayerDefn(); int fieldCount = featDefn.GetFieldCount(); for (int i = 0; i < fieldCount; i++) {

FieldDefn fieldDefn = featDefn.GetFieldDefn(i); string fieldName = fieldDefn.GetName(); table.Columns.Add(fieldName);

}

int featCount = layer.GetFeatureCount(1); for (int iFeat = 0; iFeat < featCount; iFeat++) {

Feature feat = layer.GetFeature(iFeat + 1); if (feat == null) {

goto NextFeature;

} DataRow row = table.NewRow(); for (int i = 0; i < fieldCount; i++) {

FieldDefn fieldDefn = featDefn.GetFieldDefn(i); string fieldName = fieldDefn.GetName(); string fieldVale = feat.GetFieldAsString(fieldName); some chinese value are missing here?? row[fieldName] = fieldVale;

} table.Rows.Add(row);

NextFeature: ; }

by zhulongxing, 9 years ago

comment:6 by Even Rouault, 9 years ago

Do you reproduce the problem with other datasources with UTF-8 characters ? For example what happens if you try your script with the simple CSV file I attached (test-utf8.csv) ?

by Even Rouault, 9 years ago

Attachment: test-utf8.csv added

CSV files with Chinese characters in UTF-8

comment:7 by zhulongxing, 9 years ago

I havae try to read the test-utf8.csv, and the same problem with the testing.gdb ... Why??

comment:8 by zhulongxing, 9 years ago

But C++ and java bindings looks OK ...

by zhulongxing, 9 years ago

Attachment: test-utf-8_debug.png added

comment:9 by Even Rouault, 9 years ago

Cc: tamas added
Component: OGR_SFCSharpBindings
Summary: gdal-1.11.0 read a chinese field from fgdb problemC# bindings and UTF-8 characters

Tamas, it seems the above issue is a generic issue with UTF-8 characters and C# bindings.

comment:10 by zhulongxing, 9 years ago

Dear, could you tell me the problem solved in which version, please?

comment:11 by Even Rouault, 9 years ago

Milestone: 1.11.3

Removing the 1.11.3 milestone unless Tamas want to take a crack at it.

comment:12 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: assignedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.