IIRC at least UTF-16 is converted by the TYPE command.
Steffen
Script to detect type (encoding) of files
Moderator: DosItHelp
Re: Script to detect type (encoding) of files
I updated the code once again. It's a little more robust now because it explicitly treats bytes 0x00..0x07 and 0xF8..0xFF being invalid. Besides of that I changed the errorlevel logic to get more information.
errorlevel >= 2 -- UTF-8 with multibyte sequences
errorlevel == 1 -- All ASCII. This is valid UTF-8 as long as it doesn't represent UTF-7.
errorlevel == 0 -- Anything else, including ANSI codepages, UTF-16, or binary data.
However, that's all more or less a bit-twiddling hack. Some people love it, some hate it
Steffen
errorlevel >= 2 -- UTF-8 with multibyte sequences
errorlevel == 1 -- All ASCII. This is valid UTF-8 as long as it doesn't represent UTF-7.
errorlevel == 0 -- Anything else, including ANSI codepages, UTF-16, or binary data.
However, that's all more or less a bit-twiddling hack. Some people love it, some hate it
Steffen
Re: Script to detect type (encoding) of files
Hello,
several years ago I wrote a script that can determine whether or not a file is ASCI/ANSI-encoded:
https://stackoverflow.com/a/43147510
several years ago I wrote a script that can determine whether or not a file is ASCI/ANSI-encoded:
https://stackoverflow.com/a/43147510