Writing Extended ASCII char's to a file

havhav Member Posts: 299
Hi,
I am using NAV 2009 NA SP1 with NA demo database.
I have written a codeunit which creates/opens an ASCII text file and writes some text messages to it:
................
CLEAR(ErrorLog);          //ErrorLog --> a File var.
ErrorLog.TEXTMODE(TRUE);
ErrorLog.CREATE('C:\Test.txt');

ErrorLog.WRITE(TEXT001);    //TEXT001 --> a Text constant
.................

In the above code TEXT001 has below values in English and French
Language Value
English (United States) Start:
French (Canada) Début:

When i keep my current language as English(US) and run this codeunit, the file is created and if i open this file in notepad, it displays the text "Start:" correctly.
However when i change my current language to French(Canada) and run this codeunit, the file displays the text "D‚but:" instead of "Début:". Note the character 'é' is replaced with ','.
Also when i export this codeunit in .txt format, i see the same difference in the text value.

I tried changing my regional setting to French(Canada) but i see no difference.
I understand that 'é' is an extended ASCII character and i am not sure whether NAV 2009 supports extended ASCII characters when writing data to a text file.

Any idea how to resolve this?

Regards,
Hemant
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)

Comments

  • SavatageSavatage Member Posts: 7,142
    have you searched the forum for "Special Characters"
    search.php
  • havhav Member Posts: 299
    Hi,
    Thanks for your reply.
    I find this link http://www.mibuso.com/forum/viewtopic.php?f=23&t=44070&hilit=Special+characters usefull after searching for 'special characters" as suggested by you.

    I understand that NAV uses OEM encoding and the Notepad editor assumes Unicode format and hence the character is not properly translated. Further i have to download the Ansi-Ascii convertor and use the same for converting my Text constant before writing it to my file.
    I have yet not downloaded the convertor and tested it but i presume that it will solve my problem. I will do this in a while.
    However my another concern is related to exporting the codeunit object and saving it to a .txt file. I use to do source control of my NAV objects in a .txt file using MS VSS.
    Having said this, the CaptionML property of my Text constant for FRC language creates the same problem i.e. ',' instead of 'ê'.
    In this case i am not sure how to use the Ansi-Ascii convertor routines?

    Please advise.
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • vaprogvaprog Member Posts: 1,139
    Hi hav,

    vss will do the right thing regardless of the text object file encoding.
    I do not know vss in detail. If there is an option to tell vss the proper encoding, tell it your file has OEM encoding (or tell it the code page OEM uses i.e. cp850 for a standard western Europe system). This should give you the benefit of seeing the proper characters in viewers, merge or whatever, but will not alter vss's history keeping.
    You should not try to convert these files. If you insist, use some Unicode encoding (UTF16, UTF8 ...), because otherwise the conversion will fail or be lossy. NAV will need the files exactly as it exported them.

    By the way, NAV files are not proper OEM encoded files either. See encoding of exported navision objects (.txt files) for my findings concerning this.
Sign In or Register to comment.