×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Need help to the strange issue

    Hi,

    I am successfully get the xml file from server(test.xml), in that XML we have photo tag which consists of base64encoded jpg file.

    For some images it works correctly but for the large images it gives system error -1. I am decoding it using CImageDecoder. Please suggest me something.

    addition:-

    i am saving the photo tag data into test.jpg by using RFile. (Before saving i am decoding into Base64 also). Do not get the solution. Please help!!
    Last edited by SecondInnings; 2011-08-26 at 12:43.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Need help to the strange issue

    Save the file into a public place (like the memory card), and check it "manually". Try opening it from the built-in File Manager, and if it does not work, repeat the same with a PC, and if that still fails, also check it with some binary viewer.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: Need help to the strange issue

    Thanks for the reply,

    I am saving it to the local one.

    Please help me..

    Note :- i compare my files to the iphone's saving and it is working there.

    I have 2 example data a.xml, b.xml. In both case i am using same methods to decode to base64 and saving.
    Now problem is when i save it from a.xml photo tag, it is equal to the iphone's .jpg data to the iphone, but it is different if i use b.xml at my end compare to iphone.

    Now i think the issue is the saving data part. After Base64Decoder, i am getting different data in the b.xml.


    For decoding i am using this method
    TImCodecB64 b64enc;
    b64enc.Initialise();
    b64enc.Decode(aSourceData,aDecodedData);

    Now if it is the problem. why it is working for one and not for other.

    Any suggestions pl.
    Last edited by SecondInnings; 2011-08-26 at 13:51.

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: Need help to the strange issue

    Oh my God, it took 4 days to solve a small issue.

    There is a problem in these method of decoding(not correct always, works sometime).
    TImCodecB64 b64enc;
    b64enc.Initialise();
    b64enc.Decode(aSourceData,aDecodedData);

    I have used some different technique for Decoding into Base64. and solves it.

    Thanks to my team and wizard (always there) for the help..

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Need help to the strange issue

    Since you mention large files, it would be interesting to know if the length of the output files is correct or not. If you are using Xml::CParser for parsing, note that you may get multiple OnContentL calls for your Base64-encoded data. In this case you should either concatenate the parts and do the decoding in one step, or you can do the decoding in multiple steps, but the b64enc.Initialise should be invoked only once, at the beginning (and the same object has to be used for decoding the multiple fragments), and the output has to be concatenated, of course.

  6. #6
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: Need help to the strange issue

    Actually everything was OK.

    I have just used this method and it works for every jpg:--

    void CXmlHandler::Base64ToFileL(const TDesC8 &aBase64, const TFileName &aFileName)
    {
    RFs fs;
    fs.Connect();
    RDesReadStream readstream(aBase64);
    readstream.PushL();
    RFileWriteStream writestream;

    User::LeaveIfError(writestream.Replace(fs,aFileName,EFileWrite));

    writestream.PushL();
    CCnaConverterList *list=CCnaConverterList::NewLC();
    CConverterBase *conv=list->NewConverterL(TUid::Uid(KUidConverterFromBase64));
    CleanupStack::PushL(conv);

    conv->ConvertObjectL(readstream,writestream);

    writestream.CommitL();

    CleanupStack::PopAndDestroy(4); // conv, list, writestream, readstream
    fs.Close();

    }

    editing:

    b64enc.Initialise should be invoked only once,
    Oh that may be the reason but how it works for one file(for it also, it invokes many times).

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Need help to the strange issue

    Yeah, I like this stream-oriented approach more than TImCodecB64.
    (http://www.developer.nokia.com/Commu...-file-from-xml ? )

    (Reply to edit: not exactly, I mean Initialise should be invoked once per file, so if you are decoding a single .jpg file in 5 steps, only the 1st one should include the Initialise)

  8. #8
    Registered User
    Join Date
    Apr 2010
    Posts
    76

    Re: Need help to the strange issue

    I understand but for the A.xml i was doing the same thing for the single .jpg(initialize Initialise in every steps) file.

    edit:- ya i see the link, your post is always informative. You are genius.
    Last edited by SecondInnings; 2011-09-06 at 10:36.

Similar Threads

  1. Replies: 4
    Last Post: 2009-05-08, 08:00
  2. Strange issue please anybody help ?
    By aamitgupta in forum Symbian
    Replies: 11
    Last Post: 2009-05-04, 19:05
  3. Strange issue in N73, pleez help...
    By mailtomandy2000 in forum Symbian
    Replies: 1
    Last Post: 2007-05-01, 19:38
  4. Another strange stuff...really need help
    By marcgom in forum Mobile Java General
    Replies: 3
    Last Post: 2003-08-05, 14:53

Posting Permissions

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