Author Topic: ascii problem with "%"  (Read 1046 times)

0 Members and 1 Guest are viewing this topic.

vincent.r

  • Newt
  • Posts: 101
ascii problem with "%"
« on: January 11, 2023, 04:32:28 AM »
(chr 37) - "%"
(ascii "%") - 37

but if you select Mtext, (vl-string->list (cdr (assoc 1 (entget (car (entsel "Select Text :"))))))

Lisp is showing (37 37 37).

Why ? Anybody have any idea ?

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: ascii problem with "%"
« Reply #1 on: January 11, 2023, 09:24:42 AM »
It works as expected for me with Mtext but with single text it gives the same outcome as yours.
« Last Edit: January 11, 2023, 09:29:06 AM by Tharwat »

mhupp

  • Bull Frog
  • Posts: 250
Re: ascii problem with "%"
« Reply #2 on: January 11, 2023, 09:44:17 AM »
Seems fine in BricsCAD.

Code - Auto/Visual Lisp: [Select]
  1. : (vl-string->list (cdr (assoc 1 (entget (car (entsel "Select Text :"))))))
  2. Select Text :(37)

I know %%c shows up as ุ in mtext running command shows
Select Text :(37 37 99)
typing the character by holding down alt + 0216 and running command shows
Select Text :(216)

I would double check your mtext and see if their isn't 3 %'s or run this
Code - Auto/Visual Lisp: [Select]
  1. (cdr (assoc 1 (entget (car (entsel "Select Text :")))))


JohnK

  • Administrator
  • Seagull
  • Posts: 10649
Re: ascii problem with "%"
« Reply #3 on: January 11, 2023, 09:57:50 AM »
Isn't all of that subject to the font used? -i.e. if the font doesn't support the symbol (dia, percent, etc.) it will not work.

Arial font in one local could also be different from another locals (given native language needs).
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

vincent.r

  • Newt
  • Posts: 101
Re: ascii problem with "%"
« Reply #4 on: January 11, 2023, 11:13:15 PM »
It works as expected for me with Mtext but with single text it gives the same outcome as yours.

My bad Tharwat. Its Mtext & not the single line text.

vincent.r

  • Newt
  • Posts: 101
Re: ascii problem with "%"
« Reply #5 on: January 11, 2023, 11:15:17 PM »
Isn't all of that subject to the font used? -i.e. if the font doesn't support the symbol (dia, percent, etc.) it will not work.

Arial font in one local could also be different from another locals (given native language needs).

I tried with few font styles. I dont think it is related with font style.

hmspe

  • Bull Frog
  • Posts: 362
Re: ascii problem with "%"
« Reply #6 on: January 12, 2023, 05:55:49 PM »
Which CAD program are you using?

This looks to me like % is being treated as an escape character.  If you have a text (not mtext) string of "%%%" it will show on the screen as a single %. 
"Science is the belief in the ignorance of experts." - Richard Feynman

vincent.r

  • Newt
  • Posts: 101
Re: ascii problem with "%"
« Reply #7 on: January 12, 2023, 10:58:40 PM »
Which CAD program are you using?

This looks to me like % is being treated as an escape character.  If you have a text (not mtext) string of "%%%" it will show on the screen as a single %.

AutoCAD 2022

I tried typing with "%%%". AutoCAD not allowing me to type 3 %. While entering third % it converts to 1.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8728
  • AKA Daniel
Re: ascii problem with "%"
« Reply #8 on: January 12, 2023, 11:11:30 PM »
Which CAD program are you using?

This looks to me like % is being treated as an escape character.  If you have a text (not mtext) string of "%%%" it will show on the screen as a single %.

It is in some cases, anywhere printf is used, also fields are formatted with %,
I.e.   %<\AcSm SheetSet. \f "%tc4">%,  then there’s %%P , %%D etc. autocad is always on the hunt for %%