Jump to content

Recommended Posts

Posted

Look I am not saying that Lee's function isn't good... It's working - I've checked it with list '(92 85 43 48 48 68 69) and (_ascii lst) gave result 222... I am just saying that on both my comps. (netbook with A2008 ) and (PC with A2012), when typed at command line : (vl-string->list "Þ") the result was (222), so I am guessing something's wrong with your CAD, or I am guessing wrong, I should get (92 85 43 48 48 68 69) as result???

 

M.R.:?

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    11

  • grandhougday

    9

  • Ahankhah

    5

  • marko_ribar

    3

Top Posters In This Topic

Posted
Are you sure you are testing it correctly?

 

For me:

_$ (ascii "Þ")
222

 

This is the result:

Command: (vl-string->list "Þ")
(92 85 43 48 48 68 69)

 

This is some sort of wrong result - on my comp it's correct :

 

Command: (vl-string->list "Þ")
(222)

M.R.:)

 

what is your Dwgcodepage?

 

(getvar 'Dwgcodepage)

Posted
Lee,

let me edit your excellent code so the internal "ascii" function can be replaced with the new one:

 

Thank you Ahankhah :)

 

I might be inclined to code it in this way to save some unnecessary calls:

 

(defun _ascii ( ch / ls )
   (if (setq ls (cdddr (vl-string->list ch)))
       (_HexList->Decimal (reverse ls))
       (ascii ch)
   )
)

(defun _HexList->Decimal ( lst )
   (if lst
       (+  (* 16 (_HexList->Decimal (cdr lst)))
           (if (< (car lst) 65)
               (- (car lst) 48)
               (- (car lst) 55)
           )
       )
       0
   )
)

Though, both are equally valid :)

Posted

Command: (getvar 'Dwgcodepage)
"ANSI_1252"

 

M.R.

Posted
Command: (getvar 'Dwgcodepage)
"ANSI_1252"

 

M.R.

 

Your codepage is English, so the reply is correct.

Mine is Arabic ("ANSI_1256"), so I guess the reason for different behavior of AutoCAD is not due to a bug.

Posted
Your codepage is English, so the reply is correct.

Mine is Arabis ("ANSI_1256"), so I guess the reason for different behavior of AutoCAD is not due to a bug.

 

Exactly, Windows-1252 includes the Extended ASCII set (128-255), Windows-1256 (and most other code pages) does not - hence such characters are rendered as Unicode code-points)

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...