#2835 Set a codepage with command-line parameter

Branch_+_Trunk
closed-fixed
nobody
5
2010-11-11
2009-04-01
bulklodd
No

I use three codepages in my projects and I'd like to set a needed codepage for each project using a command-line parameter. I offer to call the parameter 'cp' and the syntax of command-line might look like that: winmergeu.exe -cp <codepage you need>. The codepage specified in the command line shouldn't change the one which were specified in the option dialog.

Discussion

  • bulklodd

    bulklodd - 2009-04-01
     
  • bulklodd

    bulklodd - 2009-04-01

    WinMerge 2.12.0.0

    A new command-line parameter 'cp' was added. It allows you to change a codepage for files but it doesn't influence on the set codepage. The command line syntax is as follows

    WinMergeU.exe -cp <codepage>

    2 files were changed:
    MainFrm.cpp
    MergeCmdLineInfo.cpp

    I posted a diff file from WinMerge as a patch.

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-02

    Thanks a lot for the patch!

    I'm moving this to the patch tracker so it won't get lost into feature requests...

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-02
    • labels: 572064 --> File handling
     
  • Kimmo Varis

    Kimmo Varis - 2009-04-02

    Please use the unified patch format when sending patches. The default format doesn't even tell which file you are modifying. I can quess it as I've been modifying that file, but...

    If you are using SVN and TortoiseSVN, it has nice feature to create patches easily (they are in TSVN's own format but it can be converted to traditional patch format with script).

    And unfortunately this patch doesn't work for current SVN/trunk code as I've refactored the command line handling to allow creating unit tests. You need to add new members for codepages to MergeCmdLineInfo class and parse to those variables. Then in CMergeApp::ParseArgsAndDoOpen() you can actually set the codepages.

    Bonus points for creating unit tests (/Testing/GoogleTest/CmdLine).

     
  • bulklodd

    bulklodd - 2009-04-05

    Hello there,
    I re-applied my changes to the latest revision of the source code, so I hope they are valid now. Anyway thanks a lot for your valuable advice it saved me lots of time. In addition to that I created some unit tests as well, hope you'll find them useful. I'm sorry but I have no idea what unified patch format is and what script I was supposed to use, so I posted the patch using TSVN's format.

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-05

    This looks really good after quick look! Thanks!

    TSVN patches are perfectly OK in most cases. Sometimes there are problems in applying them but I can convert them to traditional patches using script (/Tools/Scripts/tsvn_patch.py) if needed.

    Unified patch format is "almost" like TSVN patch format, and WinMerge can create them when patch format is selected as "Unified". Patch formats are also explained in Wikipedia:
    http://en.wikipedia.org/wiki/Diff

    > In addition to that I created some unit tests as well, hope you'll find them useful
    Definitely useful! Command line is one important WinMerge interface and having unit tests for it is important work in progress.

    I see this adds the same codepage for both files. I'm only wondering if there is use case for setting different codepage for both files. But I quess we go there if ever needed... No need to add it now. :)

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-07

    I did couple of small edits, removed tabs at end of line etc. And committed to SVN trunk:
    Completed: At revision: 6644

    Thanks again!

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-07
    • milestone: --> 438013
    • status: open --> open-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2009-04-08

    Closing this patch item as the patch is in SVN.

     
  • Kimmo Varis

    Kimmo Varis - 2009-04-08
    • status: open-accepted --> closed-accepted
     
  • Tim Gerundt

    Tim Gerundt - 2010-11-11

    patch file for branch R2_14

     
  • Tim Gerundt

    Tim Gerundt - 2010-11-11
    • milestone: 438013 --> Branch_+_Trunk
    • status: closed-accepted --> closed-fixed
     
  • Tim Gerundt

    Tim Gerundt - 2010-11-11

    Backported to branch R2_14 (In Revision 7417)...

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks