Options

Inport Arabic text with codeunit

m_schuurmanm_schuurman Member Posts: 7
I'm trying to import arabic text with a codeunit. When the data is saved in the navision database the arabic text is changed to "junk" characters.

I have changed the Windows regional settings to Arabic. It is possible to directly type arabic text in the navision tables, this is saved correctly. But when I try to import this with a codeunit (or dataport) it's not working.

Does anybody have a solution??

Comments

  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    Hej,

    no help with arabic characters, but it might be the same problem: In Denmark we have some (that's 3) special characters.

    They are converted wrong when reading/writing infomation to/from NAV.
    To handle this, there is a codeunit, where a char mapping between ANSI and OEMI char codes has been made.

    E.g.
    Function Ansi2Ascii(_Text : Text[250]) : Text[250]
    EXIT(CONVERTSTR(_Text,AnsiStr,AsciiStr));
    
    Function Ascii2Ansi(_Text : Text[250]) : Text[250]
    EXIT(CONVERTSTR(_Text,AsciiStr,AnsiStr));
    
    Function MakeVars()
    AsciiStr[1] := 128;
    AnsiStr[1] := 199;
    AsciiStr[2] := 129;
    AnsiStr[2] := 252;
    AsciiStr[3] := 130;
    AnsiStr[3] := 233;
    ...
    AnsiStr[95] := 179;
    AsciiStr[96] := 253;
    AnsiStr[96] := 178;
    AsciiStr[97] := 255;
    AnsiStr[97] := 160;
    

    It used as follows
    // Setup Code tables
    ConverterCodeunit.MakeVars;
    
    ... open file ...
    INFile.READ(TextLine);
    TextLine := Ansi2Ascii(TextLine);
    

    Allthouhg not solve you problem, I hope this will help you
    With Kind Regards
    Thoms Hviid Thorn
  • m_schuurmanm_schuurman Member Posts: 7
    Thomas thank you for your quick reply. I will look into this!
  • krikikriki Member, Moderator Posts: 9,120
    I am afraid that it is more difficult with Arabic characters.
    I think (if not, it is some other problem) that Arabic characters are double byte-characters. So if you import them via a dataport, you will have a problem. This because the dataport does some conversions on the text imported and does not keep the original values. So you should import them using a file-variable and open it for reading binary-values. But I don't know how it should be handled once you have the info in Navision.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.