List files by encoding type

List files by encoding type

2
NewbieNewbie
2

    Jul 01, 2006#1

    Hello,
    I have to list files with the encoding type attribute... is there any way to do it with UltraEdit?
    For example: I have 10 folders with 50 files each. Some files are in UTF-8 and others are in ANSI charset. I need to list which files are UTF and which are ANSI...
    Any help?
    Thanks!

    6,675585
    Grand MasterGrand Master
    6,675585

      Jul 01, 2006#2

      You can use Find In Files to search for a string in your files which identifies it as UTF-8 file. For example the HTML charset=utf-8 string or the XML encoding="UTF-8" or the UTF-8 BOM EF BB BF which is as string  or any UTF-8 encoded character which surely exists in all UTF-8 files.

      Then use the following macro with property Continue if a Find with Replace not found enabled to convert the Find In Files result to only a list of files sorted by name.

      InsertMode
      ColumnModeOff
      UnixReOff
      Top
      HexOn
      Find "00"
      IfFound
      HexOff
      Top
      UnicodeToASCII
      Else
      HexOff
      EndIf
      Find "----------------------------------------^p"
      Replace All ""
      Find RegExp "%Find *^p"
      Replace All ""
      Find RegExp "%Found *^p"
      Replace All ""
      Find RegExp "/[0-9]+:*$"
      Replace All ""
      SortAsc IgnoreCase RemoveDup 1 -1 0 0 0 0 0 0

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Jul 01, 2006#3

        Thanks man... but Im too newbie to achive this alone...
        I cant consider that files have html tags or encoding attributes - just have to check if it is saved as UTF-8, ANSI, etc...