diff -r 7c4a911dc066 -r 541af5ee3ed9 imgtools/imglib/host/testutf16str.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgtools/imglib/host/testutf16str.cpp Wed Aug 18 17:23:33 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "UTF16String.h" +#include +#include +#include +using namespace std ; + +#ifdef __LINUX__ +#define stricmp strcasecmp +#endif + +void PrintHelp(){ + cout << "Syntax: TestUTF16Str <-[mbtou|utomb] > -i inputfilename -o outputfilename "< 3){ + if(memcmp(buffer,utf8FileHdr,sizeof(utf8FileHdr)) == 0){ + mbstr += 3; + length -= 3 ; + } + } + UTF16String theStr(mbstr , length); + if(length > 0 && theStr.IsEmpty()){ + cerr << "Convert Error[From UTF8 To UTF16]."<(utf16FileHdr),sizeof(utf16FileHdr)); + ofs.write(reinterpret_cast(theStr.c_str()),length); + cout << "Done."<(buffer); + length >>= 1; + if(*unistr == 0xFEFF){ + unistr ++ ; + length -- ; + } + UTF16String theStr(unistr , length); + string mbstr ; + if(!theStr.ToUTF8(mbstr)){ + cerr << "Convert Error[From UTF16 To UTF8]."<(utf8FileHdr),sizeof(utf8FileHdr)); + ofs.write(mbstr.c_str(),mbstr.length()); + cout << "Done."<