Options

[solved] Navision 2016 C/AL Charset special char Euro sign €

DanielFDanielF Member Posts: 21
edited 2016-04-14 in NAV Three Tier
Hello everybody,

C/AL Editor has a strange behaviour - I guess the charset of my development environment does not match the database.

For example I can't assign the Eurosign € to a textconstant:

TextConstant := '€';

after compiling C/AL Editor shows:

TextConstant := '?';

How can I achieve to save and compile the Eurosign € into my database?

Yours sincerly and tia
Daniel

Comments

  • Options
    swpoloswpolo Member Posts: 80
    What if you create text constant in Global Variables and assign value there?
    Nav Upgrades and DEV outsourcing
    Reports transformation to RDLC
    List -1h , Complex List -3h, Document -4h (dev hours)
    navisionupgrade.com
  • Options
    DanielFDanielF Member Posts: 21
    That was my first work around - the result was the same. It did not work.
  • Options
    DuikmeesterDuikmeester Member Posts: 304
    VAR
      VarChar@50000 : Char;
      VarText@50001 : Text;
    BEGIN
      VarChar := 8364;
      VarText[1] := VarChar;
      MESSAGE(VarText);
    END;
    
  • Options
    DanielFDanielF Member Posts: 21
    Thanks a lot Duikmeester. I still can't believe this would and could be a problem in NAV 2016.
  • Options
    DuikmeesterDuikmeester Member Posts: 304
    The problem is the Development Environment is still OEM encoding. Even the object text export/import is OEM.

    p.s. please mark as solved ;)
  • Options
    DanielFDanielF Member Posts: 21
    Okay I'll mark it - but OEM encoding?! Are there more consequences wich I am not aware of?
  • Options
    DuikmeesterDuikmeester Member Posts: 304
    edited 2016-04-14
    Don't know about the DE version of the database. However the NL version has a Report 11000007 Export BTL91-ABN AMRO which contains the following code:
    Text := CONVERTSTR(Text,
        'ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜøØáíóúñÁÂÀ¢¥ãÃðÐÊËÈiÍÎÏËÈÌÓßÔÒõÕµÚÛÙýÝ',
        'CueaaaaceeeiiiAAEaAooouuyOUoOaiounAAAcyaAoDEEEiIIIEEIOBOOoOuUUUyY');
    

    if I export this object as text, edit it in Notepad and import it again it will be converted into:
    Text := CONVERTSTR(Text,
        '??????????????????????????????????????????????i??????????????????',
        'CueaaaaceeeiiiAAEaAooouuyOUoOaiounAAAcyaAoDEEEiIIIEEIOBOOoOuUUUyY');
    

    or:
    Text := CONVERTSTR(Text,
        '€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š› ¡¢£¤µ¶·½¾ÆÇÐÑÒÓÔiÖ×ØÓÔÞàáâãäåæéêëìí',
        'CueaaaaceeeiiiAAEaAooouuyOUoOaiounAAAcyaAoDEEEiIIIEEIOBOOoOuUUUyY');
    

    depending the settings of the text editor.

    Editing NAV code in textfiles with a text editor you will have to set the editor explicitly to using OEM encoding when the code contains characters which have different code point between OEM and ANSI or ISO-8859-1 or UTF-8.

    TLDR; Dont work with code outside of NAV itself unless you know what you are doing!
  • Options
    vaprogvaprog Member Posts: 1,118
    You may have noticed, that the Euro-sign is not even contained in the OEM character set cp850 as used in western European windows versions. NAV used to map some additional characters into cp850, among them the €. Now, NAV 2016 appears to no longer use those additional glyphs, but instead uses the standard cp850 ones. The editor uses unicode or ansi, then converts it. Thus it saves € as ? (that's the standard ASCII question mark), because there is no conversion possible. When you try to use an ML-text constant, the GUI (Windows client) draws the € as ░, which is the glyph that Cp850 uses for codepoint 176, which NAV used to use to store €.

    See also encoding of exported navision objects (.txt files)

    I did not know that the Char type now supports Unicode codepoints. Thanks, Duikmeester, for pointing that out.

    The NAVDACH objects used to use similar conversion tables. You could not export those as text objects and later re-import them without distorting the conversion. I assume, with the new editor you would destroy them even with a simple save?
  • Options
    Maria-SMaria-S Member Posts: 90
    And for reports you apparently need to use labels to show Euro sign properly
    https://community.dynamics.com/nav/b/dynamicsblognav/archive/2016/02/04/nav2016-w10-euro-zeichen-in-reports-nicht-mehr-richtig-anzeigt

    But with labels the dynamical change of report language (based on document language code) doesn't work.

    :D (and this is hysterical laugh)
Sign In or Register to comment.