Ansi-Ascii converter

AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
edited 2009-04-24 in Download section
Ansi-Ascii converter
Convert ANSI characters to ASCII and back!

http://www.mibuso.com/dlinfo.asp?FileID=287

Discuss this download here.

Comments

  • AsallaiAsallai Member Posts: 141
    Hi,

    I try this function, but it doesn't work.
    Anyone can help me to find a way to convert Ascii to Ansi and back?
    :(
    Thank you very much!

    Andras
  • guentherguenther Member Posts: 8
    Hi,

    I am really new in programming in Attain. Some things I can programmed since I knew Attain, but now I got a problem.

    I downloaded Ansi2Ascii and want to use it now. Can anyone tell me how I can call the function ansi2ascii from a dataport? Cause NA is not able to export all the german letters.

    Can anyone help with my problem?
    MSDynamicsNAV 2009 Build 32012 Classic Client
    MS SQL Server 2008
  • ZinZin Member Posts: 6
    I got the same problem: did you manage to find a better way?

    Thanks,
    Zin
  • guentherguenther Member Posts: 8
    Hi,

    nope. I still use the codeunit 99999 this was delivered by Navision.
    Put the Codeunit as a variable and give the field to export an extra name.
    Then write the following code in the dataport:

    Name_co := Ansi.Ascii2Ansi(Name);

    this was to export the name from Customer. Call the function "Ansi" from the codeunit and write the value into another var.

    I hope this is what you wanted to know.

    Greetings,
    Michael
    MSDynamicsNAV 2009 Build 32012 Classic Client
    MS SQL Server 2008
  • janpieterjanpieter Member Posts: 298
    Verry nice and usefull,

    but i do not think i quite understand it, or i notice there must be a problem with ansi character 95 being converted to ascii character 221.

    This seems to cause a problem, i was rewriting a visual basic function in C/AL and the output of the function seemed to be the same but not when this character was in the input string.

    I thinks this behavior is invalid isn't it ?
    In a world without Borders or Fences, who needs Windows and Gates?
  • Timo_LässerTimo_Lässer Member Posts: 481
    guenther wrote:
    [...] I still use the codeunit 99999 this was delivered by Navision. [...]
    I think that your codeunit 99999 is not delivered by Navision. This is a solution from your Navision Partner ;-)
    (Have a look in the documentation header ;-) )
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • markborgesmarkborges Member Posts: 170
    Actually this codeunit works just fine!

    Perfect job!

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
  • DeKirstenDeKirsten Member Posts: 2
    I am very happy with this function, for I have to export our German and Swedish customers to .csv every now and then.
    I have spent many hours in the past using 'search & replace' to get these foreign characters right.

    Now it took me 3 minutes to download, program it into my report, and export all data. With valid chars!

    :mrgreen:
    If you can't join them, beat them.
  • ajhvdbajhvdb Member Posts: 672
    I'm confused :? :shock:

    If I import I need Ansi2Ascii

    If I export I need Ascii2Ansi

    Correct? YES
    See: http://www.mibuso.com/forum/viewtopic.p ... ascii2ansi
  • ajhvdbajhvdb Member Posts: 672
    Solved by using the search. :-s
  • kiyackiyac Member Posts: 118
    Hi,

    I am using this convertor tool provide in this post and found out following issue

    Problem description :
    Data "United Kingdom" after convert, it reads as "UnitedÿKingdom". It seems that space becomes ÿ

    Is there any idea or fix on it? Besides, is there any potential / known incorrect characters?
  • ajhvdbajhvdb Member Posts: 672
    Try this one: viewtopic.php?f=23&t=32912&p=160747#p160747

    looks easier to implement (with less characters)
  • SavatageSavatage Member Posts: 7,142
    kiyac wrote:
    Hi,
    I am using this convertor tool provide in this post and found out following issue
    Problem description :
    Data "United Kingdom" after convert, it reads as "UnitedÿKingdom". It seems that space becomes ÿ
    Is there any idea or fix on it? Besides, is there any potential / known incorrect characters?

    PS I got this work & it rules - their is another post somewhere that updates a few of the conversions - but I can't find it even tho I just used it a few minutes ago.

    anyway - are you sure you're converting in the right direction?

    Where SpecialChars is a Global->Codeunit->"What ever you numbered you CU"
    CountryName := SpecialChars.Ansi2Ascii(CountryName);

    EDIT: Here I exported the updated one I found
    http://savatage99.googlepages.com/CU501 ... verter.txt
  • dmccraedmccrae Member, Microsoft Employee Posts: 144
    Remember that this code represents only one example of encoding characters.

    Part of the confusion here, and why you might experience invalid characters, are for the following reasons:

    1. Because the ANSI characters set is not one thing. It is an encoding system that maps to many different ANSI code pages; this download is encapsulating one such code page, probably ANSI 1252. If you are using a different ANSI code page, some characters (or rather, code points) will not convert as you expect.

    2. Because ASCII is a 7-bit encoding, but NAV is not actually using this anyway. NAV is using OEM encoding, which is an 8-bit encoding too and also has many code pages. The closest to ASCII is OEM 437; closest meaning that most code points that are possible to represent in ASCII are also in OEM 437 up until code point 128, with OEM having more beyond this of course, as does an ANSI code page.

    So what you get here is a snapshot of one possible character conversion, which may or may not work for you depending on your environment (ANSI and OEM system code pages in windows) and the characters you actually need to convert. This is just inherent in the single byte code page system. If I create a file from NAV containing all characters, using my OEM 850 based computer and e-mail it to someone using OEM 437, then many extended characters will not be convertable, and will "look wrong". And in any case, both OEM 437 and OEM 850 are not ASCII.

    A good source or information on this and more is here: http://www.joelonsoftware.com/articles/Unicode.html
    Dean McCrae - Senior Software Developer, NAV Server & Tools

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • SavatageSavatage Member Posts: 7,142
    I see what you mean i need ã to translate - the converter does many characters but not that one. perhaps I can keep adding strange characters as they come up.
Sign In or Register to comment.