Chinese character added to entity xdata by lisp doesn't show correctly

Chinese character added to entity xdata by lisp doesn't show correctly

Miralkong
Advocate Advocate
266 Views
1 Reply
Message 1 of 2

Chinese character added to entity xdata by lisp doesn't show correctly

Miralkong
Advocate
Advocate

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.

0 Likes
267 Views
1 Reply
Reply (1)
Message 2 of 2

Automohan
Advocate
Advocate

What's your problem with English ! ??

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes