4 #include "utf8conv.hxx"
6 /*****************************************************************************/
8 // MARKER(update_precomp.py): autogen include statement, do not remove
9 #include "precompiled_transex3.hxx"
10 #if defined(UNX) || defined(OS2)
11 int main( int argc
, char *argv
[] )
13 int _cdecl
main( int argc
, char *argv
[] )
15 /*****************************************************************************/
18 fprintf( stderr
, "xgfconv InputFile OutputFile\n" );
22 ByteString
sInput( argv
[ 1 ] );
23 ByteString
sOutput( argv
[ 2 ] );
25 SvFileStream
aInput( String( sInput
, RTL_TEXTENCODING_ASCII_US
), STREAM_STD_READ
);
26 if ( !aInput
.IsOpen()) {
27 fprintf( stderr
, "ERROR: Unable to open input file!\n" );
31 SvFileStream
aOutput( String( sOutput
, RTL_TEXTENCODING_ASCII_US
), STREAM_STD_WRITE
| STREAM_TRUNC
);
32 if ( !aOutput
.IsOpen()) {
33 fprintf( stderr
, "ERROR: Unable to open output file!\n" );
40 while ( !aInput
.IsEof()) {
41 aInput
.ReadLine( sLine
);
42 ByteString sLangId
= sLine
.GetToken( 0, '\t' );
43 ByteString sFile
= sLine
.GetToken( 1, '\t' );
44 ByteString sText
= sLine
.Copy( sLangId
.Len() + sFile
.Len() + 2 );
46 USHORT nLangId
= sLangId
.ToInt32();
47 CharSet aCharSet
= Export::GetCharSet( nLangId
);
48 if ( aCharSet
!= 0xFFFF && sText
.Len()) {
49 sText
= UTF8Converter::ConvertToUTF8( sText
, aCharSet
);
50 ByteString sOutput
= sFile
;
55 aOutput
.WriteLine( sEmpty
);
59 aOutput
.Write( sOutput
.GetBuffer(), sOutput
.Len());