Search code examples
javascriptleafletarcmap

Bad text from dbf(shapefile)


i have leaflet with plugin https://github.com/calvinmetcalf/leaflet.shapefile and i tried create shapefile in ArcMap and set value in attribute table on russian like 'Проверка'. Next:

    function zoomToFeature_test(e) {
          map.fitBounds(e.target.getBounds());
          e.target.bindPopup('Mytest: '+e.target.feature.properties.mytest);
        }

    function onEachFeature_test(feature, layer) {
        layer.on({
                  click: zoomToFeature_test,
        });
     }


   var test_shp =  new L.Shapefile('/dostup/test_shp/3333',{
            onEachFeature: onEachFeature_test,
            style: style_test
    }).addTo(map);

"e.target.feature.properties.mytest" return like 'ÏÐÎÂÅÐÊÀ'


Solution

  • xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    <?php
         echo iconv('cp1251', 'utf-8', iconv('utf-8', 'ISO-8859-1', $string));
    ?>
    

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx