[QGIS-Developer] Loading many Excel-Files in QGIS with correct encoding

Andreas Neumann a.neumann at carto.net
Fri Jul 16 02:51:56 PDT 2021


Hi all and thanks for the discussion,

Even and I discovered that the .xls files are loading with correct 
encoding in Linux but not on Windows which leads to the assumption that 
freexl on Windows might not have been correctly compiled/linked against 
iconv.

Something that maybe Jürgen could clarify?

Thanks,

Andreas

On 2021-07-15 23:14, Andrea Giudiceandrea wrote:

> Il 15/07/2021 22:30, Nyall Dawson ha scritto:
> 
>> I don't think that's completely correct -- looking at the freexl 
>> documentation it seems that only some xls file versions are utf8, and 
>> others have a codepage indicating the encoding which needs to be read 
>> from the xls metadata:
> 
> Yes, of course BIFF5 (and previous versions), which is used until Excel 
> 95, stores internally the strings with a codepage based encoding, while 
> BIFF8 (since Excel 98), stores them internally as UTF-16LE without the 
> need of codepages.
> 
> Anyway the documentation states that: "FreeXL is intended to be 
> strictly interoperable with SQLite and SpatiaLite, so any text string 
> has to be converted to UTF-8 encoding.  GNU libiconv can easily handle 
> any required charset conversion. So we can simply fetch the appropriate 
> bytes, then call iconv() as appropriate, and we'll immediately get back 
> the corresponding UTF-8 encoded text string."
> 
> So, if I'm not mistaken, the decoding from the proper internal codec 
> and the encoding to UTF-8 is handled by the FreeXL library for both 
> BIFF2/BIFF5 and BIFF8.
> I've also tested a BIFF5 XLS using ogrinfo, and the output is UTF-8 
> encoded, while internally
> 
> Regards.
> 
> Andrea
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210716/fdf2ae37/attachment.html>


More information about the QGIS-Developer mailing list