Message 1 of 2
Chinese character added to entity xdata by lisp doesn't show correctly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys. I use the script to add xdata to entities in AutoCAD. When the xdata content is in English, it works fine. However when the text is in Chinese, it shows weird characters in "list xdata" function from Express tools.
-purge A * N
(defun C:AddData()
(setq ssEntities (ssget "X"))
(if (/= ssEntities nil)
(progn
(setq n 0)
(repeat (sslength ssEntities)
(setq entName (ssname ssEntities n))
(setq entity (entget entName))
(setq appname "test")
(if (/= (tblsearch "appid" appname) T)
(regapp "test")
)
(setq exdata
'((-3 ("test"
(1001 . "测试代码")
)))
)
(setq newent
(append entity exdata))
(entmod newent)
(setq n (1+ n))
)
(setq ssEntities nil)
)
)
(command "_.qsave")
(command "_.exit")
(command "_.close")
(princ)
)
AddData
Could anyone tell me where I did it wrong. Thanks a lot.