Changeset 274

Show
Ignore:
Timestamp:
01/18/2007 03:18:33 PM
Author:
luedi
Message:

added a patch to solve the long outstanding encoding issue (#44)
The patch adds a new --encoding parameter to ssphys and vss2svn, so that the user can specify his own encoding like "vss2svn --encoding="iso-8859-5""

Thanks to Ori Avtalion for the patch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/script/vss2svn.pl

    r273 r274  
    107107############################################################################### 
    108108sub LoadVssNames { 
    109     &DoSsCmd("info \"$gCfg{vssdatadir}/names.dat\""); 
     109    &DoSsCmd("info -e$gCfg{encoding} \"$gCfg{vssdatadir}/names.dat\""); 
    110110 
    111111    my $xs = XML::Simple->new(KeyAttr => [], 
     
    247247    } 
    248248 
    249     &DoSsCmd("info \"$filesegment[0]/$filesegment[1]/$filesegment[2]\""); 
     249    &DoSsCmd("info -e$gCfg{encoding} \"$filesegment[0]/$filesegment[1]/$filesegment[2]\""); 
    250250 
    251251    my $xml = $xs->XMLin($gSysOut); 
     
    918918 
    919919    if (! -e "$exportdir/$physname.$version" ) { 
    920         &DoSsCmd("get -b -v$version --force-overwrite \"$physpath\" $exportdir/$physname"); 
     920        &DoSsCmd("get -b -v$version --force-overwrite -e$gCfg{encoding} \"$physpath\" $exportdir/$physname"); 
    921921    } 
    922922 
     
    942942Temp Dir     : $gCfg{tempdir} 
    943943Dumpfile     : $gCfg{dumpfile} 
     944VSS Encoding : $gCfg{encoding} 
    944945 
    945946SSPHYS exe   : $gCfg{ssphys} 
     
    15531554sub Initialize { 
    15541555    GetOptions(\%gCfg,'vssdir=s','tempdir=s','dumpfile=s','resume','verbose', 
    1555                'debug','timing+','task=s','revtimerange=i', 'ssphys=s'); 
     1556               'debug','timing+','task=s','revtimerange=i','ssphys=s','encoding=s'); 
    15561557 
    15571558    &GiveHelp("Must specify --vssdir") if !defined($gCfg{vssdir}); 
     
    15631564    # XML output from ssphysout placed here. 
    15641565    $gCfg{ssphysout} = "$gCfg{tempdir}/ssphysout"; 
     1566    $gCfg{encoding} = 'windows-1252' if !defined($gCfg{encoding}); 
    15651567 
    15661568    # Commit messages for SVN placed here. 
     
    16921694    --debug           : Print lots of debugging info. 
    16931695    --timing          : Show timing information during various steps 
     1696    --encoding        : Specify the encoding used in VSS; 
     1697                        Default is windows-1252 
    16941698EOTXT 
    16951699 
  • trunk/ssphys/SSPhys/Formatter.cpp

    r262 r274  
    5151{ 
    5252public: 
    53   CXMLFormatter (
     53  CXMLFormatter (std::string encoding
    5454    : m_pCurrentFileNode (NULL) 
    5555  { 
    5656    // patch this line to match your VSS DB's locale 
    57     TiXmlDeclaration decl ("1.0", "windows-1252", ""); 
     57    TiXmlDeclaration decl ("1.0", encoding, ""); 
    5858    m_Document.InsertEndChild (decl); 
    5959  } 
     
    302302 
    303303////////////////////////////////////////////////////////////////////// 
    304 std::auto_ptr<CFormatter> CFormatterFactory::MakeFormatter (eStyle style, po::variables_map const& vm) 
     304std::auto_ptr<CFormatter> CFormatterFactory::MakeFormatter (eStyle style, std::string encoding, po::variables_map const& vm) 
    305305{ 
    306306  if (style == eBinary) 
    307307    return std::auto_ptr<CFormatter> (new CBinaryFormatter (/*value*/)); 
    308308  if (style == eXML) 
    309     return std::auto_ptr<CFormatter> (new CXMLFormatter ()); 
     309    return std::auto_ptr<CFormatter> (new CXMLFormatter (encoding)); 
    310310  if (style == eVSS) 
    311311    return std::auto_ptr<CFormatter> (new CVssFormatter ()); 
     
    325325    return std::auto_ptr<CFormatter> (new CBinaryFormatter (/*value*/)); 
    326326  if (style == "xml") 
    327     return std::auto_ptr<CFormatter> (new CXMLFormatter ()); 
     327    return std::auto_ptr<CFormatter> (new CXMLFormatter (options["encoding"].as<std::string>())); 
    328328  if (style == "vss") 
    329329    return std::auto_ptr<CFormatter> (new CVssFormatter ()); 
     
    340340  descr.add_options () 
    341341    ("style,s", po::value<std::string>()->default_value("XML"), "output style {XML|binary|vss|dump}"); 
     342  descr.add_options () 
     343    ("encoding,e", po::value<std::string>()->default_value("windows-1252"), "VSS text encoding for the XML output style"); 
    342344  return descr; 
    343345} 
  • trunk/ssphys/SSPhys/Formatter.h

    r158 r274  
    6060{ 
    6161public: 
    62   static std::auto_ptr<CFormatter>  MakeFormatter (eStyle style, po::variables_map const& vm); 
     62  static std::auto_ptr<CFormatter>  MakeFormatter (eStyle style, std::string encoding, po::variables_map const& vm); 
    6363  static std::auto_ptr<CFormatter>  MakeFormatter (po::variables_map const& vm); 
    6464  static po::options_description    GetOptionsDescription (); 

These ads are automatically generated by Google based on the content of this page. Revenue from these ads helps to pay for hosting fees of this site; however, these ads do not constitute an endorsement by PumaCode.org.