Accented letters does not print/display correctly
Hi,
I have multiple lisps that prints some text in Bricscad and while some of them displays the string correctly with accented letters, some other call won't display correctly.
As an example. Take a look at the attached picture.
The princ call displayed correctly while the alert call did not.
Some one knows how to avoid such a mess?
Can it be related to the text editor? I use Notepad++ and the regular Windows Notepad to edit my lisps.
Thanks
Comments
-
Found my answer.
I now think that all «PRINC» statements displays accented letters correctly.
Other functions like (command "Text"...) or (Alert ...) require Unicode. Thanks to https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/inserting-text-with-accented-characters-with-a-lisp/td-p/10135767
Example : (Alert "Acc\\U+00E8s") ; will display the word «Accès».
while (princ "Accès") ; will correctly display the word «Accès».0 -
That is not the full story. This is (also) related to the encoding used for the Lisp file.
0 -
Ohhh that's interesting. How can i select the right encoding and prevent the need to use Unicode?
0 -
-
You were totally right! Worked like a charm.
The default encoding was UTF-8 instead of ASCII...Thanks a lot @Roy Klein Gebbinck
Watch out for this, people
0 -
Dear All,
actually, both BricsCAD + AutoCAD (>= 2021/2022 ?) can handle LISP files with UTF encoding ...
problem is, that virtually all editors save as UTF-8 WITHOUT the BOM marker;
as consequence, application code has no way to distinguish whether a text file is plain "ANSI" or "UTF-8 without BOM";For UTF-16, the BOM is strictly required, for UTF-8 the BOM is optional ... clear design fault with UTF-8, straight from beginning :-(
So still best + safest approach : never use UTF formats for AutoLISP, but plain ANSI (even when it sometimes requires the Unicode encryption via "\U+"many greetings !
0 -
Thanks a lot @Torsten Moses! Interesting.
0