[gdal-dev] Encoding (FGDB)

Paul Ramsey pramsey at cleverelephant.ca
Thu Jun 9 12:16:54 EDT 2011


Awesome, exactly what I hoped! Thanks Frank.
P

On Thu, Jun 9, 2011 at 11:26 AM, Frank Warmerdam <warmerdam at pobox.com> wrote:
> On 11-06-09 10:33 AM, Paul Ramsey wrote:
>>
>> So, the FGDB API works with (mostly) UTF16-encoded wide characters
>> (wstring).
>>
>> What is the GDAL internal standard for string encoding? Looks like
>> (from the OLCStringsAsUTF8 capability) there is at least a loose
>> standard that is looking for UTF8 narrow characters. Are there any
>> existing utilities for conversion from UTF16 to UTF8 and vice versa in
>> GDAL/OGR? We have a string2wstring function in the early FGDB code,
>> but as far as I can tell it is just narrowing/widening the characters,
>> and any non-ASCII characters would probably get screwed on the way
>> through.
>
> Paul,
>
> Yes, the standard for handling this is to translate to UTF8 as discussed
> in:
>
>  http://trac.osgeo.org/gdal/wiki/rfc23_ogr_unicode
>
> To convert from UTF16 to UTF8 use CPLRecodeFromWChar() like:
>
>  const char *pszUTF8 =
>     CPLRecodeFromWChar( pwszUTF16, CPL_ENC_UCS2, CPL_ENC_UTF8 );
>
> Make sure you CPLFree( pszUTF8 ) when you are done with it.
>
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list