diff options
author | Pascal Junck <pjunck@openoffice.org> | 2004-11-02 15:03:47 +0000 |
---|---|---|
committer | Pascal Junck <pjunck@openoffice.org> | 2004-11-02 15:03:47 +0000 |
commit | 04e19d8999bc8bcc69f95ce318fc35d85ad0a59c (patch) | |
tree | 43b1db2c0ad1f16df7a395aea7b6cd03ab7150d0 /transex3 | |
parent | 6c625fb80966f6bb1583e703a5fc3c1ffd43a868 (diff) |
INTEGRATION: CWS ivo05 (1.31.8); FILE MERGED
2004/09/22 13:23:14 ihi 1.31.8.1: #i34128# Strip UTF8 Byte Order Marker
Diffstat (limited to 'transex3')
-rw-r--r-- | transex3/source/cfgmerge.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx index 017bc59c21f3..df062ad7954e 100644 --- a/transex3/source/cfgmerge.cxx +++ b/transex3/source/cfgmerge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cfgmerge.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: hr $ $Date: 2004-08-02 16:24:39 $ + * last change: $Author: pjunck $ $Date: 2004-11-02 16:03:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ ByteString sInputFileName; ByteString sActFileName; ByteString sOutputFile; ByteString sMergeSrc; +String sUsedTempFile; CfgParser *pParser; @@ -249,15 +250,33 @@ int EndCfgExport() return 1; } +void removeTempFile(){ + if( !sUsedTempFile.EqualsIgnoreCaseAscii( "" ) ){ + DirEntry aTempFile( sUsedTempFile ); + aTempFile.Kill(); + } +} + /*****************************************************************************/ extern FILE *GetCfgFile() /*****************************************************************************/ { + FILE *pFile = 0; // look for valid filename if ( sInputFileName.Len()) { - - // able to open file? - FILE *pFile = fopen( sInputFileName.GetBuffer(), "r" ); + if( Export::fileHasUTF8ByteOrderMarker( sInputFileName ) ){ + DirEntry aTempFile = Export::GetTempFile(); + DirEntry aSourceFile( String( sInputFileName , RTL_TEXTENCODING_ASCII_US ) ); + aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); + String sTempFile = aTempFile.GetFull(); + Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); + pFile = fopen( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ).GetBuffer(), "r" ); + sUsedTempFile = sTempFile; + }else{ + // able to open file? + pFile = fopen( sInputFileName.GetBuffer(), "r" ); + sUsedTempFile = String::CreateFromAscii(""); + } if ( !pFile ) fprintf( stderr, "Error: Could not open file %s\n", sInputFileName.GetBuffer()); |