Macro to convert to ANSI

Macro to convert to ANSI

2
NewbieNewbie
2

    Nov 10, 2006#1

    I am trying to create a macro that converts files to ANSI/ASCII from UniCode. Unfortunately, sometimes the files are already in ANSI/ASCII format and the convert from Unicode to ASCII command ruins the file.

    Is there a way to test the format of the file so I can decide what conversion to use? :?

      Nov 10, 2006#2

      I think I came up with something. 8) The unicode files I am trying to convert have the following 2 bytes in the header "ÿþ" or "FF FE". So I am looking for those bytes in hex mode and converting if they exist. But I am getting an error on my macro (see below). :cry:

      InsertMode
      ColumnModeOff
      UnixReOff
      HexOn
      Find "FF FE"
      IfFound
      UnicodeToASCII
      EndIf
      Save
      CloseFile

      344
      MasterMaster
      344

        Nov 10, 2006#3

        What is the error ?
        If you have an unsaved "new file", save will just quit in an IO-error.
        The makro "works" with previous saved files, either I can't say if unicode-transform works.
        Normally using all newest english version incl. each hotfix. Win 10 64 bit

        6,684586
        Grand MasterGrand Master
        6,684586

          Nov 10, 2006#4

          The conversion to ASCII should not be done in hex edit mode.

          InsertMode
          ColumnModeOff
          HexOn
          Top
          Find "FF FE"
          IfFound
          HexOff
          UnicodeToASCII
          IfNameIs ""
          SaveAs ""
          Else
          Save
          EndIf
          EndIf
          CloseFile
          Best regards from an UC/UE/UES for Windows user from Austria