Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28695
    David
    Participant

    I have thousands of text files with ANSI encode and want to convert to GB 2312 in batch. Now, we have to open all of them via “File-> Save All with Encoding”.
    My question is : how to convert encode of these files without openning files, such as using command line.
    I have tried “Emeditor.exe “C:\Users\elan\Desktop\*.txt” /cp 65001 /cps 936 ” but it doesn’t work. Does anyone have suggestions? Thanks!

    #28722
    Yutaka Emura
    Keymaster

    You can write a macro to save a file as GB2312 (my sample as below), and then use the Advanced Open on the File menu or the Run with Temporary Options on the Macros menu to specify all the files to convert.

    
    document.Encoding = 936;  // Chinese Simplified (gb2312)
    s = document.FullName;
    nExt = s.lastIndexOf( "." );
    nBackslash = s.lastIndexOf( "\\" );
    if( nExt == -1 || nExt < nBackslash ) {
    	nExt = s.length;
    }
    s = s.substr( 0, nExt ) + "-gb2312" + s.substr( nExt );
    document.Save( s );
    
    #28737
    David
    Participant

    Thank you for your information.I will try and feedback.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.