Before you start
What happened?
Loading a local CAD drawing through Add data → CAD Layer imports geometry, but Chinese TEXT / MTEXT and layer names in the attribute table are mojibake.
The drawing is a DXF with $DWGCODEPAGE = ANSI_936 (GBK). Desktop GDAL (ogrinfo / ogr2ogr) decodes the same file correctly. In GeoLibre the attribute table shows GBK bytes interpreted as Latin-1 / Windows-1252, for example:
| Field |
Actual (mojibake) |
Expected |
| Layer |
¼¯µçÏß· |
集电线路 |
| Text |
μ Àý |
图例 |
| Text |
·ûºÅ |
符号 |
| Text |
ÄÚÈÝ |
内容 |
| Text |
ÊýÁ¿ |
数量 |
| Text |
·çµç³¡ |
风电场 |
| Text |
ZC-YJLV22-26/35kV-3¡Á95mm2 |
ZC-YJLV22-26/35kV-3×95mm2 |
SubClasses is AcDbEntity:AcDbMText / AcDbEntity:AcDbText:AcDbAttribute, so these rows are CAD text entities, not a separate encoding in GeoJSON.
Likely cause: CAD files are opened with DuckDB-WASM ST_Read (bundled GDAL). That build has no iconv, so it copies each file byte as a Latin-1 character instead of honouring $DWGCODEPAGE. × (GBK A1 C1) becoming ¡Á is the same pattern.
This is distinct from labels being off by default (labels.enabled is false). Even with labels enabled, the Text field is already garbled, so the map cannot show the original Chinese.
Steps to reproduce
- Run the web app from source (
npm run dev) on current main.
- Open Add data → CAD Layer and choose a DXF whose header has
$DWGCODEPAGE = ANSI_936 and whose TEXT/MTEXT is Chinese (a 192-byte sample is linked below).
- Add the
entities layer.
- Open the attribute table and look at the Layer and Text columns.
Expected behavior
Text and Layer should be Unicode Chinese, matching desktop GDAL on the same file (工程名称, 集电线路, ×, …). Mojibake such as ¼¯µçÏß· and ¡Á should not appear.
How are you running GeoLibre?
Web build from source (npm run dev), main @ 5b89c26, v2.6.0
Operating system and browser
Ubuntu 24.04 + Chrome
Sample data
Any AutoCAD DXF with $DWGCODEPAGE = ANSI_936 and Chinese TEXT reproduces this. A minimal sample (one TEXT entity 集电线路) is here:
https://github.com/mfkj8866/GeoLibre/blob/fix/cad-text-encoding/issue/ansi936-text.dxf
The original drawing is DXF AC1018, $DWGCODEPAGE = ANSI_936, with TEXT/MTEXT such as 工程名称, 集电线路, 兴业大平山风电项目, and ZC-YJLV22-26/35kV-3×95mm2. It is larger than GitHub's issue-attachment limit, so it is not uploaded here.
Screenshots or logs
Attribute table after loading the CAD layer. Red arrows mark garbled Layer and Text values (¼¯µçÏß·, μ Àý, ¡Á, …):

Before you start
What happened?
Loading a local CAD drawing through Add data → CAD Layer imports geometry, but Chinese TEXT / MTEXT and layer names in the attribute table are mojibake.
The drawing is a DXF with
$DWGCODEPAGE = ANSI_936(GBK). Desktop GDAL (ogrinfo/ogr2ogr) decodes the same file correctly. In GeoLibre the attribute table shows GBK bytes interpreted as Latin-1 / Windows-1252, for example:¼¯µçÏß·集电线路μ Àý图例·ûºÅ符号ÄÚÈÝ内容ÊýÁ¿数量·çµç³¡风电场ZC-YJLV22-26/35kV-3¡Á95mm2ZC-YJLV22-26/35kV-3×95mm2SubClassesisAcDbEntity:AcDbMText/AcDbEntity:AcDbText:AcDbAttribute, so these rows are CAD text entities, not a separate encoding in GeoJSON.Likely cause: CAD files are opened with DuckDB-WASM
ST_Read(bundled GDAL). That build has no iconv, so it copies each file byte as a Latin-1 character instead of honouring$DWGCODEPAGE.×(GBKA1 C1) becoming¡Áis the same pattern.This is distinct from labels being off by default (
labels.enabledis false). Even with labels enabled, theTextfield is already garbled, so the map cannot show the original Chinese.Steps to reproduce
npm run dev) on currentmain.$DWGCODEPAGE = ANSI_936and whose TEXT/MTEXT is Chinese (a 192-byte sample is linked below).entitieslayer.Expected behavior
TextandLayershould be Unicode Chinese, matching desktop GDAL on the same file (工程名称,集电线路,×, …). Mojibake such as¼¯µçÏß·and¡Áshould not appear.How are you running GeoLibre?
Web build from source (
npm run dev),main@ 5b89c26, v2.6.0Operating system and browser
Ubuntu 24.04 + Chrome
Sample data
Any AutoCAD DXF with
$DWGCODEPAGE = ANSI_936and Chinese TEXT reproduces this. A minimal sample (one TEXT entity集电线路) is here:https://github.com/mfkj8866/GeoLibre/blob/fix/cad-text-encoding/issue/ansi936-text.dxf
The original drawing is DXF
AC1018,$DWGCODEPAGE = ANSI_936, with TEXT/MTEXT such as工程名称,集电线路,兴业大平山风电项目, andZC-YJLV22-26/35kV-3×95mm2. It is larger than GitHub's issue-attachment limit, so it is not uploaded here.Screenshots or logs
Attribute table after loading the CAD layer. Red arrows mark garbled Layer and Text values (
¼¯µçÏß·,μ Àý,¡Á, …):