zoukankan      html  css  js  c++  java
  • shapefile 编码错误问题解决 Wrong codepage of shapefile Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.

    linux下运行,因为大部分shapefile 文件,在使用时都没有指定字符集,所以qgis只能从环境变量中获取设置环境变量中获取SHAPE_ENCODING。

    目前唯一的解决办法就是设置环境变量

    $ SHAPE_ENCODING=UTF-8
    $ export SHAPE_ENCODING
    $ qgis

    I insist that this is a QGIS issue.

    GDAL 1.9.0 (and newer) is trying to interpret the encoding setting from the shape file itself. When creating a new shape file “ENCODING” should be passed as an attribute, which, obviously, is not done.

    Calling qgis from terminal allows two track down an warning messages. Saving non-Latin characters in a shape files generates following warning message: “Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.
    This warning will not be emitted anymore”.

    On the other hand, most of the shape files used by users are without character encoding byte. So QGIS has to operate with environmental variable “SHAPE_ENCODING”. At present the only solution is to use the same character coding for the given QGIS session, e.g.:

    SHAPE_ENCODING=UTF-8 export SHAPE_ENCODING qgis

    The example above allows to create and edit shape files with UTF-8 as a character encoding (example for Linux users, Windows users must use “SET SHAPE_ENCODING=UTF-8”).

    ------------------------------------------------
    Excerpt from

    http://trac.osgeo.org/gdal/wiki/ConfigOptions

    In C/C++ configuration switches can be set programmatically like this:

    #include "cpl_conv.h" 
    ...
    CPLSetConfigOption( "GDAL_CACHEMAX", "64" );

    Normally a configuration option applies to all threads active in a program, but they can be limited to only the current thread this way:

    CPLSetThreadLocalConfigOption( "GDAL_CACHEMAX", "64" );

     由 zirneklitis - 更新于 一年以上 之前

    The Linux example above should be as follows:

    $ SHAPE_ENCODING=UTF-8
    $ export SHAPE_ENCODING
    $ qgis
  • 相关阅读:
    [Unity] 2D开发学习教程
    [Unity] 查找资源
    [Unity] UGUI研究院之游戏摇杆
    [Unity] Unity3D研究院编辑器之自定义默认资源的Inspector面板
    [Unity] Unity3D研究院编辑器之独立Inspector属性
    [Unity] 精灵动画制作中需要注意的一些问题
    [Unity] 常用技巧收集
    IDEA相关设置
    Hive配置文件hive-site.xml
    MySql通用二进制版本在Linux(Ubuntu)下安装与开启服务
  • 原文地址:https://www.cnblogs.com/mfryf/p/3547982.html
Copyright © 2011-2022 走看看