Skip to content
Permalink
Browse files

Remove unneeded variable

  • Loading branch information
m-kuhn committed Feb 4, 2016
1 parent 27f1637 commit 768f0e896929794a0c0690f50f1cc09099321736
Showing with 0 additions and 2 deletions.
  1. +0 −2 src/core/qgsvectorfilewriter.cpp
@@ -1724,8 +1724,6 @@ bool QgsVectorFileWriter::addFeature( QgsFeature& feature, QgsFeatureRendererV2*

OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
{
QgsLocaleNumC l;

OGRFeatureH poFeature = OGR_F_Create( OGR_L_GetLayerDefn( mLayer ) );

qint64 fid = FID_TO_NUMBER( feature.id() );

4 comments on commit 768f0e8

@jef-n

This comment has been minimized.

Copy link
Member

@jef-n jef-n replied Feb 5, 2016

That was supposed to avoid wrong decimal delimiters (ie. comma vs. points) - is that now handled elsewhere?

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Feb 5, 2016

Uhm... who works with strange locales anyway 😇

@mbernasocchi

This comment has been minimized.

Copy link
Member

@mbernasocchi mbernasocchi replied Feb 7, 2017

@jef-n are we sure that this works? I wrote a test case where it does not:

# use any locale with comma decimal separator
test_locale = 'it_IT.UTF-8'
orig_path = './test_data.shp'

# this file will have numbers with comma in the dbf
dest_path = './result.shp'

# end config

import sys, locale
from qgis.core import QgsVectorFileWriter, QgsVectorLayer, QgsApplication

# init QGIS
qgs = QgsApplication(sys.argv, False)
qgs.initQgis()

l = QgsVectorLayer(orig_path, 'test layer', 'ogr')
print 'feature Count %s' % l.featureCount()

old_locale = locale.getlocale(locale.LC_NUMERIC)
locale.setlocale(locale.LC_NUMERIC, test_locale)
QgsVectorFileWriter.writeAsVectorFormat(l, dest_path, 'UTF-8', l.crs(), 'ESRI Shapefile')
locale.setlocale(locale.LC_NUMERIC, old_locale)

msg = 'open %s with a text editor and you should find numbers separated by comma'
print msg % dest_path.replace('shp', 'dbf')

locale_bug.zip

do you want me to file a bug report?

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Feb 13, 2017

@mbernasocchi I don't remember exactly, but I guess that's on me... Can you open a pull request with this (failing) unit test?

Please sign in to comment.
You can’t perform that action at this time.