×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    43

    Unicode .txt files

    Hi,
    I want to write into a unicode .txt file.

    Creating an unicode file is easy:
    Code:
        RFs fsSession;
        CleanupClosePushL(fsSession);
        User::LeaveIfError(fsSession.Connect());
        RFileWriteStream writerStream;
        writerStream.PushL();
        User::LeaveIfError(writerStream.Create(fsSession, (_L("C:\\data\\test.txt")), EFileWrite));
        writerStream.WriteL((_L8("ÿþ")));
        writerStream.CommitL();
        writerStream.Pop();
        writerStream.Release();
        CleanupStack::PopAndDestroy(&fsSession);
    but how to fill it?
    RFile and RFileWriteStream just use ANSI coding and ignore the BOM.
    Can somebody help me?

    Regards

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,091

    Re: Unicode .txt files

    Use CnvUtfConverter::ConvertFromUnicodeToUtf8(TDes8 &aUtf8, const TDesC16 &aUnicode) & write the converted string to file.Look into SDK for more info.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: Unicode .txt files

    It depends on what kind of file you want at the end.
    UTF-8, or even UTF-7? Use CnvUtfConverter
    However if you can go with 16-bit Unicode files too, and your 2-byte BOM suggests that, also check TTextFile.

  4. #4
    Registered User
    Join Date
    Jun 2012
    Posts
    43

    Re: Unicode .txt files

    thanks vineet.jain and wizard_hu_, it works via CnvUtfConverter

Similar Threads

  1. Building a Carbide C++ project with Unicode source files
    By SwordAngel in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2008-04-03, 10:14
  2. How to parse xml files with special Unicode chars?
    By harry_zhang in forum Symbian
    Replies: 10
    Last Post: 2007-11-13, 16:48
  3. Unicode resource files
    By simworks in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2005-07-06, 21:15
  4. Unicode resource files
    By simworks in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2005-07-06, 15:06
  5. about .loc files and Unicode
    By drakest1 in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-09-08, 20:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×