Unicode characters problem in AutoCAD 2025

Unicode characters problem in AutoCAD 2025

ziggy63
Contributor Contributor
2,010 Views
8 Replies
Message 1 of 9

Unicode characters problem in AutoCAD 2025

ziggy63
Contributor
Contributor

Hi to all,

In my applications I use both VB.NET and AutoLISP. Some VB.NET applications create temporary text files (*.txt) that are then read by a Lisp function. As I live in Greece, these files include many Unicode characters. After having upgraded my BV.NET projects from .NET Framework to .NET 8.0, the Unicode characters are not read correctly by Lisp. For example, this is a screenshot from AutoCAD 2024:

ziggy63_0-1712906679848.png

And this is the same screenshot from AutoCAD 2025:

ziggy63_2-1712906786724.png

I haven't changed anything in my VB.NET projects, I have just upgraded them, using the Upgrade Assistant. To create the temporary files, I use the "FileOpen" function. When I open the txt file with Notepad, the Unicode characters appear correctly (for example "Δ" or "%%c"). But when Lisp opens the file, it produces gibberish. I know that all this sounds... Greek to you, but does anybody know why this is happening? Does "FileOpen" behave differently in .NET than it does in .NET Framework?

 

Thanks in advance,

ziggy63

 

0 Likes
2,011 Views
8 Replies
Replies (8)
Message 2 of 9

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

not sure to be able to help, but I would start with differentiating if the issue is from your VB.NET code now writing the LISP file (content of the LISP file has already issues) or running the LISP then in AutoCAD 2025.

 

Let your VB.NET code for 2024 write the LISP-file, then run the LISP in AutoCAD 2025 ... and vice versa:

Let your VB.NET code for 2025 write the LISP-file, then run the LISP in AutoCAD 2024

 

When do you now see the issues?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 9

ziggy63
Contributor
Contributor

Hi Alfred,

I tried what you suggested and the result is the same: the culprit is VB.NET for AutoCAD 2025. The problem has to do with the encoding of the txt file. In the previous versions of AutoCAD, the encoding of the file was "ANSI", now it is "UTF-8". So, if I find out how to change the encoding of the text file created by of the "FileOpen" function, the problem will be solved.

Best regards,

Ziggy63

0 Likes
Message 4 of 9

daniel_cadext
Advisor
Advisor

I thought you could specify encodings in .NET?

Maybe use StreamReader, StreamWriter with System.Text.Encoding

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 5 of 9

kerry_w_brown
Advisor
Advisor

You may need to look at this:

https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-AC74D827-0969-4888-91C0-C3149DEC3659

 

and the LISPSYS system variable determines if AutoLisp treats strings as ANSI or UTF-8

. . . probably worth checking.

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 6 of 9

ziggy63
Contributor
Contributor

Hi Kdub,

I don't think it has to do with AutoLisp. After all, my applications worked fine in previous versions of AutoCAD (2024 and prior) with LISPSYS = 0. I will try changing the encoding of the text file while creating it in VB.NET.

Thank you all for your answers.

0 Likes
Message 7 of 9

kerry_w_brown
Advisor
Advisor

Hi @ziggy63 

Refer the  Comparison with other encodings section

https://en.wikipedia.org/wiki/UTF-8#See_also:~:text=of%20invalid%20input.-,Comparison%20with%20other...

 

If you are using UTF-8 for Greek characters I can't imagine why you would force AutoLISP to read the strings as ACSII by using LISPSYS = 0 ??

 

added :

Though, I must admit, the documentation in the AutoLisp docs is a little vague regarding the requirements.

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 8 of 9

kerry_w_brown
Advisor
Advisor

@ziggy63,

as @daniel_cadext mentioned, how are you writing the file ??

 

perhaps try something like  :

https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/csharp/language-compilers/read...

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 9 of 9

ziggy63
Contributor
Contributor

Yes, I think I will change the way I create the text file, and hope this will solve the problem.

Thanks,

ziggy63

0 Likes