Detect file Code Page by viewer/editor plugin.
Posted: Sat 12 Jul, 2014 21:45
Hello. I did not post here from long time.
I googled, but do not find any solution. So I ask here. How to check what code page is for loaded file in FAR viewer/editor? I want to make simple plugin in Delphi which simulate F8 key press or change code page like for F8 key pressed. It is useful for *.nfo files which contain ASCII logos.
Now I'm using my own loader associeted with Total Commander F3/F4, key which execute FAR in ConEmu. And when filename have .nfo extension it simulate F8 key pressing. But it do not work perfectly for all files, which sometimes load too slow. Or some non .nfo files which contain ASCII which need to press F8 key to display corectly. And CodePage as far as I know is visible only in FAR Editor by pressing Shift+F2 code.
Summary. So I want do something like that. If code page of file is not 852 (OEM) simulate press F8. Do I must do some detection of file content and if it contain some chars used in ASCII logos, then simulate press F8? But what values should it be, greater than decimal: 128? Greater than decimal: 174? Or some else value?
Please give me some hints or code examples. Thanks in advance. And sorry for my bad English.
I googled, but do not find any solution. So I ask here. How to check what code page is for loaded file in FAR viewer/editor? I want to make simple plugin in Delphi which simulate F8 key press or change code page like for F8 key pressed. It is useful for *.nfo files which contain ASCII logos.
Now I'm using my own loader associeted with Total Commander F3/F4, key which execute FAR in ConEmu. And when filename have .nfo extension it simulate F8 key pressing. But it do not work perfectly for all files, which sometimes load too slow. Or some non .nfo files which contain ASCII which need to press F8 key to display corectly. And CodePage as far as I know is visible only in FAR Editor by pressing Shift+F2 code.
Summary. So I want do something like that. If code page of file is not 852 (OEM) simulate press F8. Do I must do some detection of file content and if it contain some chars used in ASCII logos, then simulate press F8? But what values should it be, greater than decimal: 128? Greater than decimal: 174? Or some else value?
Please give me some hints or code examples. Thanks in advance. And sorry for my bad English.