You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] Layer names do not support Chinese characters. #2404
A GDS2 file cannot carry a file name string. So it is omitted during export, and only the layer/datatype combination is stored.
An OASIS file can carry a file name string; however, it must be 7-bit ASCII.
Therefore, any Asian character in UTF-8 is replaced with an asterisk.
In my data, a layer name having 7 Chinese characters is represented by '*******'.
One, two, and three with '*', '**', and '***', respectively.
I found that it is indeed related to the file encoding.
The original DXF was in ANSI format, and layer names appeared as garbled text when opened in KLayout;
however, after I saved the DXF as UTF-8, it displayed correctly when opened again.
1.demo.dxf with ANSI
2.demo.dxf with UTF-8
3.However, when I renamed the layer and saved the file, the change didn't actually take effect; upon reopening the file, the layer name had reverted to the original.
However, when I renamed the layer and saved the file, the change didn't actually take effect; upon reopening the file, the layer name had reverted to the original.
"File -> Save Layer Properties", we can save the name of the layer.
But it's too troublesome. A new file (*.lyp) has been added.
I originally thought that the "Save" function could directly modify the dxf file.
Only in this way we can use other CAD software to interpret the names of the new layers.
thanks for this discussion and in particular to @Kazzz for the (as usual) meticulous analysis!
I have some comments here:
GDS as you noticed does not support layer names at all. Be careful with non-ASCII cell names as KLayout uses UTF-8 for the encoding and other tools may not understand that.
OASIS is pretty strict when it comes to allowed characters. The original specification allows a small subset of ASCII only. For text strings I dropped this restriction and copy the texts as UTF-8, but names (layer names, property names, cell names) are a different thing. By default, KLayout replaces forbidden characters by "*", but you can configure that on the OASIS page of the Writer Options. If you delete that character, no substitution happens and you can save any kind of layer name - at the risk of generating incompatible OASIS files.
Layer names are written to DXF in UTF-8 encoding. Also upon reading, KLayout expects UTF-8 encoding. I don't know if that is compatible with the DXF standard, but I assume it's not. If someone has a valid DXF file with non-ASCII names that can be shared, I'll be happy to take a look. BTW: DXF does not support layers with layer/datatypes only. These are converted into LxDy-names.
I'd like to take the opportunity to point you to the LStream format I introduced. This format does not have any constraints regarding names and employs UTF-8 encoding everywhere.
Since however every stream format has different abilities, the best solution actually is to use the layer properties files. These also allow defining colors and much more, so I think there is enough benefit to compensate for the need of a second file.
Activity
d-m-bailey commentedon Jul 27, 2026
@libaineu2004 What text are you trying to display?
I can manually rename the layers to Chinese characters (Japanese).
If you can manually edit the layer names to Chinese, but can't read them in, then it may be a file I/O problem.
libaineu2004 commentedon Jul 28, 2026
Manual editing is possible; however, the changes are lost when the DXF file is reopened. The manual renaming was not saved.
d-m-bailey commentedon Jul 28, 2026
Ok, so this may be a dxf import related issue.
Kazzz-S commentedon Jul 28, 2026
Hi,
In my experiments, behaviors are a bit different, as follows.
Nothing is weird to me.
1. Environment and sample files
2. Generation flow of different image files
KLayout (new design) ===> gh2404-In.dxf
gh2404-In.dxf ===> QCad Pro ===> gh2404-01.png
3. Encoding of the DXF files
4. My understandings
Therefore, any Asian character in UTF-8 is replaced with an asterisk.
In my data, a layer name having 7 Chinese characters is represented by '*******'.
One, two, and three with '*', '**', and '***', respectively.
libaineu2004 commentedon Jul 28, 2026
I found that it is indeed related to the file encoding.
The original DXF was in ANSI format, and layer names appeared as garbled text when opened in KLayout;
however, after I saved the DXF as UTF-8, it displayed correctly when opened again.
1.demo.dxf with ANSI
2.demo.dxf with UTF-8
3.However, when I renamed the layer and saved the file, the change didn't actually take effect; upon reopening the file, the layer name had reverted to the original.
libaineu2004 commentedon Jul 28, 2026
environment
klayout v0.30.7
windows 10 x64
However, when I renamed the layer and saved the file, the change didn't actually take effect; upon reopening the file, the layer name had reverted to the original.
d-m-bailey commentedon Jul 28, 2026
@libaineu2004 once you have the layers defined as you want, try saving the layer information with
File->Save Layer PropertiesThen if you load a file that has unreadable layer names, user
File->Load Layer Propertiesto restore the layer names.libaineu2004 commentedon Jul 29, 2026
"File -> Save Layer Properties", we can save the name of the layer.
But it's too troublesome. A new file (*.lyp) has been added.
I originally thought that the "Save" function could directly modify the dxf file.
Only in this way we can use other CAD software to interpret the names of the new layers.
klayoutmatthias commentedon Aug 1, 2026
Hi folks,
thanks for this discussion and in particular to @Kazzz for the (as usual) meticulous analysis!
I have some comments here:
I'd like to take the opportunity to point you to the LStream format I introduced. This format does not have any constraints regarding names and employs UTF-8 encoding everywhere.
Since however every stream format has different abilities, the best solution actually is to use the layer properties files. These also allow defining colors and much more, so I think there is enough benefit to compensate for the need of a second file.
Matthias