Display conversion ANSI or OEM

Display conversion ANSI or OEM

2
NewbieNewbie
2

    Feb 15, 2006#1

    Is there a way to show on toolbar the status of a text file, if it is in ANSI or OEM format and disable convert OEM to ANSI if it is already in ANSI and disable ANSI to OEM if it is already in OEM ?

    Thanks
    Robert

    63
    Advanced UserAdvanced User
    63

      Feb 15, 2006#2

      Hi Robert

      First off if someone else can answer this any better please do!

      Robert your text file is made up of ASCII codes.
      It's my understanding that OEM & ANSI are font "Code Pages".
      So really the difference between OEM & ANSI is how they are displayed or which code page is used to display the same ASCII characters.

      In text files there is nothing that says which code page to use!
      (sort of like difference between a text file vs word processor file)
      So I don't know how UltraEdit could know which font to display between OEM & ANSI.

      I believe this to be true, the first 127 ASCII characters are pretty much the same between OEM & ANSI but from 128 to 255 MAJOR differences!
      OEM has it's roots back in the original IBM PC with DOS.
      I remember programing in basic and getting little smiley faces to display.
      And to type characters above 127 you had to hold the ALT key down and use the keypad to manually enter decimal code for the character.
      Boy I'm showing my age!

      I found some good info on Answers dot com, searched on "Windows code pages" also search on OEM & ANSI
      http://www.answers.com/main/......=2222_1

      So the bottom line is HOW the ASCII characters are displayed OEM vs ANSI and the only place this will makes a major difference is above 128 decimal or 7F hex.
      Check out "ASCII Table" under the "View" pull down menu in UE.

      I hope this helps, anyone else is welcome to anwser this question.

      2
      NewbieNewbie
      2

        Feb 15, 2006#3

        My problem is that i program in the good known ANSI format ; but when i use a special compiler i must convert the file in OEM. And often I forget that i have already converted in OEM and ask to reconvert in OEM than I have problems with some special caracters like the éèàç ... So i wanted something that can catch my attention.

        6,675585
        Grand MasterGrand Master
        6,675585

          Feb 16, 2006#4

          What you are doing is really very dangerous. I know that because in our company there are also some files which must be still coded in OEM.

          I have 3 possible solutions for your problem:

          1) Use UltraEdit with a second ini-file where OEM is set by default and which have a different text background or text color. This is the method we use in our company. For example you have uedit32.ini for normal editing in ANSI mode. Copy all uedit32.* files to ueditoem.* in the same directory and create a shortcut to UltraEdit with following command line

          "C:\Program Files\UltraEdit\uedit32.exe" /i="path to ueditoem.ini\ueditoem.ini"

          Start UltraEdit with this ini-file and select once a different text or text background color and enable the OEM Character Set in the View menu. Now this UltraEdit instance always edits in OEM character set with automatical conversion from ANSI to OEM and vice versa during copy and paste from other applications. You should never start UltraEdit twice if you have not activated Allow multiple instances and the UltraEdit with OEM ini-file is already running.

          2) If your files for this compiler have a file extension with no other file for any other application has than you could use the Word Wrap/Tab Settings configuration dialog to add this file extension to the list of extensions and select for this extension a font with font option Use OEM Fixed Pitched Font enabled. The files with this extension are then automatically edited with OEM codes and you never need to convert it. UltraEdit handles copy and paste automatically correct, even when copied from an ANSI file.

          3) You could use a macro for conversion to OEM. Here is a small example:

          InsertMode
          ColumnModeOff
          HexOff
          Find RegExp "[éèàç]"
          IfFound
          AnsiToOem
          EndIf

          This macro searches for the ANSI characters which should be convert to OEM. If it founds any of these characters, it converts the whole file from ANSI to OEM. Don't forget to enable the macro property Continue if a Find with Replace not found for this macro.

          But better would be to convert the file from ANSI to OEM manually with consecutive replaces. This would allow you to fix files with mixed codes. Example:

          InsertMode
          ColumnModeOff
          HexOff
          Top
          Find "é"
          Replace All "‚"
          Find "è"
          Replace All "Š"
          Best regards from an UC/UE/UES for Windows user from Austria