Jump to content

Lisp returns "�" character when reads block attribute in ZWCAD


Recommended Posts

Posted

Hi,

I have a lisp routine that works fine in AutoCAD. However, when I run the same routine in ZWCAD, it seems that some characters turn into the "�" character. I believe it's because of UTF-8 encoding, but I couldn't understand where to fix this problem.

An example of what I'm reporting is shown in the image below. "entidade" contains the DXF structure for an Block. The block name is "CABEÇALHO". When I retrieve the block name via lisp, it returns "CABE�ALHO".

Thank you very much in advance!

W3zXDd7.png

 

Posted

When you look carefully at "CABEÇALHO" the Ç is an extended character, ie a alt+num so ZWcad is trying to display with possibly a font that does not have Ç as a character. 

 

Bricscad was OK.

 

If there is a way of defining the font to be used for display in ZWcad then it may display correct.

  • Like 1
  • Agree 1
  • Thanks 1
Posted

Thank you very much, Bigal!

 

Following your suggestion, I found the following option not in ZWCAD itself, but in Visual Studio (installed along with ZWCAD): 

File >> Preferences >> Settings >> Text Editor > Auto Guess Encoding
I've checked on this option and the routine worked normally with the extended characters .

 

In Visual Studio preferences there is even an option to change the encoding format from UTF-8 to another format, but it only worked by checking the option above.

 

I just couldn't understand why a setting in Visual Studio affects the behavior of ZWCAD itself. I imagined that the two applications would be somewhat independent.
I believe that on each machine I run the routine, I should check this option in Visual Studio.

 

Again, thank you very much for your help!

Posted

I know that this is cheating but can you call the block something different, without the extended characters? A quick fix but maybe not the best fix

  • Thanks 1
Posted

Have a lisp that pulls names from existing text. it would error if it contained any windows illegal characters. so i have it automatically check and replace with this line.

 

(setq blkname (vl-string-translate "<>:\"/\\|?*" "    _     " blkname))  ;replace ileagel characters with space and / with _

 

If you can't change the default font in ZWcad like BIGAL said. maybe list all the illegal characters and translate them to something else/similar that can be dispalyed.

  • Thanks 1
Posted

 

19 minutes ago, Steven P said:

I know that this is cheating but can you call the block something different, without the extended characters? A quick fix but maybe not the best fix

Hi Steve!

It's an alternative. However, I don't just read the "block name" property, but I also read values that the user has entered into attribute fields.
And as the language is Portuguese, even if I change the block name, the user can type texts in the attribute fields that contain these characters.
Anyway, thanks for the suggestion.

  • Like 1
Posted
3 minutes ago, mhupp said:

Have a lisp that pulls names from existing text. it would error if it contained any windows illegal characters. so i have it automatically check and replace with this line.

 

(setq blkname (vl-string-translate "<>:\"/\\|?*" "    _     " blkname))  ;replace ileagel characters with space and / with _

 

If you can't change the default font in ZWcad like BIGAL said. maybe list all the illegal characters and translate them to something else/similar that can be dispalyed.

 

Thanks for the suggestion, mhupp.

I think it's better to work this way than to always have to change software settings.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...