Inserting text with accented characters with a lisp

Inserting text with accented characters with a lisp

Anonymous
Not applicable
1,882 Views
3 Replies
Message 1 of 4

Inserting text with accented characters with a lisp

Anonymous
Not applicable

Hi all!

 

I started to write my own very first lisps with autolisp.

Basically i want some often used texts to insert more easily.

 

Simple task right? Of course it isnt easy enough for Autocad, it just HAD to complicate it as it always does with EVERYTHING....

 

So I live in Hungary, where we use a lot of accented characters, like ö, ü, ó, ő, etc.. I am using Autocad 2021 hungarian version the program seems to handle these kind of characters. 

 

My code looks like this now:

 

(defun c:Abut ()
(setq pt1 (getpoint "\nSzöveg helye: "))
(setq ang (getangle pt1 "Szöveg iránya: "))
(setq deg (Rad2Deg ang))
(command "_text" "s" "Arial" pt1 "0.375" deg "Aszfalt-beton út")
(princ)
)

(defun Rad2Deg(ang)
(/ (* ang 180.0) pi)
)

 

Well, I am getting this as text: "Aszfalt-beton Ăşt"

 

Wtf?


Does anyone know how can i solve this?

I am on a very beginner level, i just started with lisps.

Thanks in advence!

 

0 Likes
Accepted solutions (1)
1,883 Views
3 Replies
Replies (3)
Message 2 of 4

john.uhden
Mentor
Mentor

I know nothing about Hungarian umlauts, but I'm happy to see that WTF is universal. <lol>

John F. Uhden

0 Likes
Message 3 of 4

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

(command "_text" "s" "Arial" pt1 "0.375" deg "Aszfalt-beton út")


 

Use UNICODE  standards

(command "_text" "s" "Arial" pt1 "0.375" deg
	   "Aszfalt-beton \\U+00FAt"))

where

ú "\\U+00FA"
ö "\\U+00F6"
ü "\\U+00FC"
ó "\\U+00F3"

Use this link to convert strings to unicode ---> https://www.compart.com/en/unicode/ 

Then you're all set.

 

 "U+0048" "U+0054" "U+0048"

 

Message 4 of 4

Anonymous
Not applicable

Thanks very much that worked!