[gdal-dev] Can't read column name of a gdb file with lattin letters

Tomer tomerlieber at gmail.com
Mon Apr 25 00:23:43 PDT 2016


Hi, 

I sent this post again because it wasn't sent to the mailing list in the
first time.

I use c# bindings for GDAL and I want to read the column names of a gdb
file. 
The problem is that if the column name is written with latin letters, e.g.
Arabic, I get gibberish with less characters than expected. 
The problem exists because GDAL uses a string to save column names, and this
type can only contain ascii characters. 
Therefore the openFileGdb driver skips on every second byte when reading the
column names of a gdb file. 

You can find it in the source code: 

File: filegdbtable.cpp 
Line: 1689 
for(j=0;j < nColNameCarCount;j++) // FIXME> UTF16 
        osFieldName = pabyCur[2 * j] 

Because it's a diffcult to change the column name type to a wstring, which
can contain UTF8 charcaters, 
I thought of a creative way to solve the problem. 
I read all the bytes of the column name without skipping every second byte
and save the bytes as a string 
and then, I get the column name with all the bytes in the c# bindings and
decode them as UTF8. 

Here is what i changed in the source code: 

File: filegdbtable.cpp 
Line: 1689 
for(j=0;j < 2 * nColNameCarCount;j++) 
        osFieldName = pabyCur[j] 

After I changed the source code and complied it, I still got gibberish with
less characters than expected 
when I tried to read the column name from the c# bindings, so I couldn't
decode it to UTF8. 

My questions is: Why couldn't I read the column names correctly even after
the changes I made? 

If someone has another way to deal with this problem, please let me know. 

Thanks, 
Tomer



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Can-t-read-column-name-of-a-gdb-file-with-lattin-letters-tp5262714.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list