Opened 13 years ago
Closed 6 years ago
#3833 closed defect (fixed)
libkml locale support
Reported by: | bishop | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description (last modified by )
While creating kml file using lib kml, if file name, fields names and data used locale strings, the output file is wrong: if I convert locale strings to UTF-8 - the data inside file correct, but file name is wrong (path is unreadable by most of programmes); if I don't convert locale strings to UTF-8 - the data inside file is not correct, but file name is right. The kmz file in most cases is unreadable (the Google Earth open such a file but it is empty).
Attachments (2)
Change History (6)
follow-up: 2 comment:1 by , 13 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
This is simple code. Path, layer and field name is UTF8 encoded russian text "тест_файл", "тест_слой" and "тест_поле". After GDAL shifted to UTF in file names, this code generate valid kml, but kmz is not valid.
#include "ogrsf_frmts.h" int main() { const char *pszDriverName = "LIBKML"; OGRSFDriver *poDriver; OGRRegisterAll(); poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( pszDriverName ); if( poDriver == NULL ) { printf( "%s driver not available.\n", pszDriverName ); exit( 1 ); } OGRDataSource *poDS; CPLString sName("d://temp//тест_файл.kmz"); poDS = poDriver->CreateDataSource( sName, NULL ); if( poDS == NULL ) { printf( "Creation of output file failed.\n" ); exit( 1 ); } OGRLayer *poLayer; poLayer = poDS->CreateLayer( "тест_слой", NULL, wkbPoint, NULL ); if( poLayer == NULL ) { printf( "Layer creation failed.\n" ); exit( 1 ); } OGRFieldDefn oField( "тест_поле", OFTString ); oField.SetWidth(32); if( poLayer->CreateField( &oField ) != OGRERR_NONE ) { printf( "Creating Name field failed.\n" ); exit( 1 ); } OGRDataSource::DestroyDataSource( poDS ); }
Also, simple command
set GDAL_FILENAME_IS_UTF8=OFF ogr2ogr -f LIBKML -nln тест_слой d:\temp\тест_Файл.kml D:\work\testgeodata\shp\test.shp
generate invalid kml with valid name, and if GDAL_FILENAME_IS_UTF8=ON - everything is invalid.
It seems to me that libkml driver generate ASCII encoded files, but most software expected UTF8 encoded kml.
by , 11 years ago
Attachment: | ge_screenshoot.png added |
---|
The Google Erath screen with valid and invalid data
comment:4 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I guess there shouldn't any issue anymore if GDAL is properly used (ie filenames and content set to UTF-8)
bishop
can you provide examples of this?
brian