Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

  • edited August 9

    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».

  • That is not the full story. This is (also) related to the encoding used for the Lisp file.

  • Ohhh that's interesting. How can i select the right encoding and prevent the need to use Unicode?

  • In Notepad++:
    Encoding -> Convert to ANSI

    zip
    zip
    test-ansi-utf-8.zip
    324B
  • edited August 11

    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 :wink:

  • edited August 17

    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 !

  • Thanks a lot @Torsten Moses! Interesting.

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam