Lisp problems with Turkish characters (Ç, Ğ, I, İ, Ö, Ş, Ü)

Lisp problems with Turkish characters (Ç, Ğ, I, İ, Ö, Ş, Ü)

Anonymous
Not applicable
1,707 Views
5 Replies
Message 1 of 6

Lisp problems with Turkish characters (Ç, Ğ, I, İ, Ö, Ş, Ü)

Anonymous
Not applicable
Hello
I have several lisps that load the name of the file and layouts to put it in different attribute texts
(this one, for example)
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-batch-rename-layouts-accordi...

My problem is that these lisps fail when the name of the file or the layouts contain a Turkish letter such as the ones in the title of the post, as it doesn't store it correctly as a string variable.

Is it possible to overcome this issue? My Autocad version is not Turkish and I'm blocked many times due to this.
Thank you so much.
0 Likes
1,708 Views
5 Replies
Replies (5)
Message 2 of 6

roland.r71
Collaborator
Collaborator

First off, there's nothing Turkish about these characters, just because the Turkish use 'm (like the french, Germans, Spanish, etc,etc.etc.)

 

Second, these are not part of the regular character table, but the extended part. Problem there is the extended part is font specific. So, you won't see 'm, with some fonts (just "?" or something else (ö shows as % for example) you did not want)

 

Your string is actually a list of references to such a font-character-table. Switching the font, might just switch your extended characters & therefor your text. So, using the right font is key.

 

That's the only thing i can think of right now, as your example code works perfect for me. The string IS stored correctly. If i use my lastname (which contains such (german) characters) it works like a charm. The sheet name is named correctly.

 

Example-

if the file is named: Grüß

(setq name (vl-filename-base (getvar "dwgname")))

returns...

"Grüß"

Using it to rename sheets works just as well. (right here, on my system, which is English / US-International)

0 Likes
Message 3 of 6

hmsilva
Mentor
Mentor

@Anonymous wrote:
Hello
I have several lisps that load the name of the file and layouts to put it in different attribute texts
(this one, for example)
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-batch-rename-layouts-according-to-drawing-file-name/td-p/7926349

My problem is that these lisps fail when the name of the file or the layouts contain a Turkish letter such as the ones in the title of the post, as it doesn't store it correctly as a string variable.

Is it possible to overcome this issue? My Autocad version is not Turkish and I'm blocked many times due to this.
Thank you so much.

Hi movieboxdv005,

I did find some problems using

(vl-filename-base (getvar "dwgname"))

 

in a dwg named "ÇĞIİÖŞÜ.dwg"... the layout was renamed to "U+015EÜ"....

Try to change

(setq name (vl-filename-base (getvar "dwgname")))

 

to

(setq name (substr (getvar 'DWGNAME) 1 (- (strlen (getvar 'DWGNAME)) 4))

 

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 4 of 6

malmattos
Contributor
Contributor

I AM USING THE FOLLOWING CODE TO SELECT A LAYER:

 

(if (not (tblsearch "layer" "E-FORÇA"))(command "layer" "new" "E-FORÇA" "c" "3" "E-;FORÇA" ""))
(command "-layer" "s" "E-FORÇA" "")

 

BUT RETURNS AN ERROR DUE TO THE CHARACTER Ç.
HOW DO I MAKE LISP UNDERSTAND WHAT IS "FORÇA"?

0 Likes
Message 5 of 6

devitg
Advisor
Advisor

@malmattos , if you are going to SET the layer as current , there is no need to ask if exist , just Make the Layer and it becomes current . 

acad do not worry if its exist or not , just use layer M 

 

(command "layer" "_m" "E-FORÇA" "c" "3"  ""))

, I did no set the linetype , because I have not it.

Yes it need to check if linetype  "E-;FORÇA"  exist, because  it is a condition to assign a linetype to a layer 

 

 

devitg_0-1645229842354.png

 

 

0 Likes
Message 6 of 6

malmattos
Contributor
Contributor

If anyone has the same problem, I managed to solve it by replacing the character Ç with \\U+00C7
example: ("força") -> ("for\\U+00C7a")

0 Likes