marko_ribar Posted February 28, 2012 Posted February 28, 2012 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. Quote
Ahankhah Posted February 28, 2012 Posted February 28, 2012 Lee Mac said: Are you sure you are testing it correctly? For me: _$ (ascii "Þ") 222 grandhougday said: This is the result: Command: (vl-string->list "Þ") (92 85 43 48 48 68 69) marko_ribar said: 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) Quote
Lee Mac Posted February 28, 2012 Posted February 28, 2012 Ahankhah said: 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 Quote
marko_ribar Posted February 28, 2012 Posted February 28, 2012 Command: (getvar 'Dwgcodepage) "ANSI_1252" M.R. Quote
Lee Mac Posted February 28, 2012 Posted February 28, 2012 http://en.wikipedia.org/wiki/Windows_code_page Quote
Ahankhah Posted February 28, 2012 Posted February 28, 2012 marko_ribar said: 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. Quote
Lee Mac Posted February 28, 2012 Posted February 28, 2012 Ahankhah said: 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) Quote
Recommended Posts
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.