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 )
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)
Change History (17)
by , 9 years ago
Attachment: | chinese_field_problem.png added |
---|
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 9 years ago
Component: | SWIG (all bindings) → OGR_SF |
---|---|
Owner: | changed from | to
Priority: | high → normal |
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
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 , 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 , 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 , 9 years ago
Attachment: | chinese_field_problem_debug.png added |
---|
comment:6 by , 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) ?
comment:7 by , 9 years ago
I havae try to read the test-utf8.csv, and the same problem with the testing.gdb ... Why??
by , 9 years ago
Attachment: | test-utf-8_debug.png added |
---|
comment:9 by , 9 years ago
Cc: | added |
---|---|
Component: | OGR_SF → CSharpBindings |
Summary: | gdal-1.11.0 read a chinese field from fgdb problem → C# bindings and UTF-8 characters |
Tamas, it seems the above issue is a generic issue with UTF-8 characters and C# bindings.
comment:11 by , 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 , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | assigned → closed |
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.
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 ?