Troubé with Base64 and qCompress/qUncompress

I need to compress and coded a QString in base 64. I wrote 2 methods for this task. These methods are:

/*
* Compress a QString and converts to Base 64
*/
QString BlackBerry10Utils::compressAndBase64(const QString ¶mString)
{
    QByteArray byteArray;
    byteArray.append(paramString);

    byteArray = qCompress(byteArray);
    byteArray.toBase64();
    byteArray.remove(0, 4);

    QString result = QString(byteArray);

    return result;
}

/**
 * Converts from Base 64 and un-compress a QString
 */
QString BlackBerry10Utils::base64AndUnCompress(const QString ¶mString)
{
    QByteArray byteArray;
    byteArray.append(paramString);

    byteArray = QByteArray::fromBase64(byteArray);
    byteArray = qUncompress(byteArray);

    QString result = QString(byteArray);

    return result;

}

And my test code:

QString str ("Hello, World!");
Str = BlackBerry10Utils::compressAndBase64 (str);

Str = BlackBerry10Utils::base64AndUnCompress (str);

However, the process does not return a str than its original value.

I used the same method in Android, Java, BlackBerry, WindowsPhone, and works very well...

There is a line in base64AndUnCompress:

QString result = QString(byteArray);

It is the equivalent of the call to QString::fromAscii() which does not work properly for most of encodings.

Try to replace it with:

QString result = QString::fromUtf8(byteArray.data(), byteArray.size());

To do the same thing according to compress too much, but it is not important for base64-encoded data, it does not use the 8th bit.

In compressAndBase64, replace

   QByteArray byteArray;
    byteArray.append(paramString);

with

QByteArray byteArray(paramString.toUtf8());

Tags: BlackBerry Developers

Similar Questions

  • I need iOS with airplay and without mirror 10

    I used my IPAD to stream Showtime for years now with Airplay without mirroring.  Now the new iOS 10 don't leave me with mirror and SHOWTIME seems to be the only one that will work with the mirroring on.  How do I get it off the coast of mirroring on the new iOS 10.

    Hello. The new control centre has two parts. Slide up, then to the left to access the right pane where you will see the devices available for AirPlay base already mentioned.

  • load is0 10 to my iidown phone 6 s after finsh my phone restarts on the screen appear (photo and conncet quail itunes) iconncet my phon with PC and open my itunes

    ADOS iso 10 to my iidown phone 6 s after finsh my phone restarts on the screen appear (photo and conncet quail itunes) iconncet my phon with PC and open my itunes

    and stil again

    Take a look at these articles:

    Solve the iOS update and restore error in iTunes - Apple Support

    Get help with iOS update or restore errors - Apple Support

  • Try to add a page to a pages document. It worked until now but just finished page 13 with text and photos and cannot add another page, using macbook pro with El Capitan and the most recent version of the Pages.

    Try to add a page to a pages document. It worked until now but just finished page 13 with text and photos and cannot add another page, using macbook pro with El Capitan and the most recent version of the Pages.

    You have placed your beam to insert at the end of your text on page 13 and then apply Insert menu: Page Break? In the v5.6.2, Pages I just add a new page to a section of four pages to this approach.

  • I created a document with textedit, and now need to add a password

    I created a document with textedit, and now need to add a password to this document that exists.  Is it possible to do?

    I'm afraid that there is not.

  • Problem with IMovie and Quick time

    Hey everybody,

    I am faced with an unexpected problem with Quicktime and I Movie, and I was wondering if someone had already known that:

    I want to create a film based on shots from my personal camera. I started to work with IMovie to create a sequence of opening and added his musical band. I exported the scenes in Quick Time format without any problem. However, when I merge the exported sequence of I film with shots of my video camera, the soundtrack is completely eliminated.

    I checked on the Internet and saw that there might be a problem of "Codecs". To avoid this, I exported the sequence IMovie with Codecs of same as one of my video camera files.

    Now, if I compare the files exported from I Movie and those of my video camera, they have identical characteristics. However, the soundtrack will always disappear when I merge them.

    Could someone please help me solve this problem?

    Thank you very much in advance.

    Concerning

    Could someone please help me solve this problem?

    Not only based on what you already said.

    I want to create a film based on shots from my personal camera. I started to work with IMovie to create a sequence of opening and added his musical band. I exported the scenes in Quick Time format without any problem. However, when I merge the exported sequence of I film with shots of my video camera, the soundtrack is completely eliminated.

    How would you"merge" files? (I.e. a "QuickTime" format is any form of data compatible with the platform of supply and the specific structure of QT incorporated into real employment that is stored in a container of MOV file on any of up to 99 tracks possible). Also, what app do you use for reading the file 'merged '? (For example, some media players ignore secondary audio tracks as a result of some methods of 'fusion' of files so it is important to know how the files are "merged," whether or not the audio data are "scattered" several tracks, and/or if the Media Player supports playback of multiple, sequential audio popular.)

    I checked on the Internet and saw that there might be a problem of "Codecs". To avoid this, I exported the sequence IMovie with Codecs of same as one of my video camera files.

    The specific codecs and settings using the specific version of iMovie? (The current Mac OS X operating systems have two X QT and 'classic' Qt integrated structure so it is important to know what structure is used here and how).

    Now, if I compare the files exported from I Movie and those of my video camera, they have identical characteristics. However, the soundtrack will always disappear when I merge them.

    As a general rule, you should review the file "merged" to determine why it does not play back correctly rather than comparing the characteristics of the source being merged files. The main problem here seems to be in your project workflow. That is, you seem to be when you perform an operation in two steps rather than edit several iMove multimedia files and then export the combined results in a video the video and audio tracks have been flattened and exported in standard compression formats with unified settings, features and the.

  • My husband doesn't like the itunes account is under my name.  I have a way that he can have his own name and sign on with her and still exist on the family account?

    My husband doesn't like the itunes account is under my name.  I have a way that he can have his own name and sign on with her and still exist on the family account?  Also, have we HAVE two-step verification?   It's a real pain.

    Yes it can have its own ID and share your content via the family sharing, he needs to sign out of your ID and to create his own, then one of you needs to invite another family sharing.

    You don't need to use 2 verification step, if you want you can disable to my Apple ID

  • I can't delete a duplicate named folders created in error by Thunderbird while moving messages with drag and drop

    I had created a folder with a long as name "Deborah Brown - HP laptop acting, very slow, etc." this file was created to contain messages that have been received in a top-level folder, and then moved to this to the appropriate ranking related emails many. I had done many times before without a problem. But this time, when I slipped and fell on a message in the folder a double was created, but accompanied by an annex of '2547417' at the end of the name. IIRC, the message was in the records at the time of the original and a copy. IIRC, I did not notice this at first and when I dragged/left down another message he created another folder in double, but this time with the suffix "211613d". At any given time more far in the process (I don't remember quite well how) both of these files got duplicated again but this time were with the same name with added suffixes as noted... something I wouldn't have imagined. Given that the messages I was moving were safely (?) stored in the original folder, I deleted the message content duplicated records duplicated without any problem and without any effect on the content of the original file.

    Then I tried to delete the duplicate folders... not allowed. Then I noticed that if I tried to remove the second instance of each duplicate name, which was a success... at least as much as to move it to the trash. If I then returned and tried to delete the first instance it is, once again, not the law. I then tried to rename the files by adding a prefix a single character. Once more, if I worked on the second instance of the name I could rename it but would be foiled again if the first instance. Then, * I think * (extra large grains of salt here) is that I renamed the second instance and removed from the trash that I could then work on the others and rename and empty the trash.

    But everything for nothing. If I closed Thunderbird and restarted the duplicate folder names reappearing. Then I tried the fix given for not being able to delete messages because of a corrupt trash folder. That did not help either. Even if I use a POP account and could remove the files from the two basket my account information, whenever I would restart Thunderbird trash will reappear by himself and the so-called deleted duplicate files right with her and in the hierarchy of their original folder.

    I'm mystified and have given up trying to remove these things. Fortunately, the removal of messages from other folders and empty the trash of these messages seem to work normally. I have not yet tried to delete another folder and hesitate to do.

    Thank you
    Chuck Norcutt
    Murrells Inlet, SC

    Thank you very much. Exactly, that solved the problem. There was almost no delay in starting. I'm still very curious as to how it happened, but it may never be known.

  • my iphone 5 s has been disabled. I'm trying to restore my iphone with itunes and itunes asks me to put the password for my iphone. but my iphone does not display the unlock screen. What should I do now?

    my iphone 5 s has been disabled. I'm trying to restore my iphone with itunes and itunes asks me to put the password for my iphone. but my iphone does not display the unlock screen. What should I do now?

    Hello

    Follow the instructions here:

    If you have forgotten the password for your iPhone, iPad or iPod touch, or your device is disabled - Apple supports

  • I created an account with Hightail (and received and responded to the verification email) but when I click on the down arrow next to Lacrosse "join".

    I created an account with Hightail (and received responded to the verification email), but when I click on the arrow next to the button "join" the 'link' button does not appear.

    Have you added hightail in the menu (alt + T) tools > options > Annexes > out.

  • problem with Safari and the opening of sites

    problem with Safari and the opening of sites

    Please describe the problem in more detail?

    Try to reset the settings of Safari:

    1. open Safari

    2. click on the Safari menu at the top (to the right of the Apple logo)

    3. Select the Preferences/Privacy tab

    4. click on remove all data from the Web site

    5. close Safari.

    Remove cache Safari files:

    1. click on finder

    2. look for the menu GO to top

    3. click on GO and hold down the option key. This will show a user library folder.

    4. click library and find the Caches folder

    5. in the folder caches com.apple.Safari Ouvrezledossier

    6. move the Cache.db file Trash.

    This should solve the problem. If it does not help, try to disable the Safari extensions

    1. open Safari

    2. click on the Safari menu at the top (to the right of the Apple logo)

    3. Select Preferences

    4. find the Extensions tab

    5 disable all extensions of

    6. relaunch Safari

  • How the other drive app option to calculate calories? I did 45 minutes yoga with him and he showed the 260 callus which is high of 45 mins of yoga session.

    How the other drive app option to calculate calories? I did 45 minutes yoga with him and he showed the 260 callus which is high of 45 mins of yoga session.

    ISuspect that is not correct.

    Hello

    Saving workouts through the app to drive using others as the type of activity, active calories are estimated at a rate equivalent to a brisk walk or based on the data recorded by the heart rate sensor, according to what is higher.

    The following steps can help to improve the accuracy of the estimates made by your watch:

    • Estimates for calories and other results depend, in part, your personal information. To verify that it is accurate:
      • On your iPhone, in the application of the watch, go to: My Watch (tab) > health > Edit (top-right).
    • While training, to optimize the performance of the heart rate sensor (data from which is used when estimating calories), make sure you wear your watch fits on top of your wrist. Apple suggests that consider you the clamping Strip before starting a workout and it loosen again thereafter.
      • Note that the heart rate sensor is likely to give better results for the workouts that involve rhythmic (such as running) rather than the irregular movements.
    • Calibrate your watch can improve the accuracy of various estimates related to the activity, including estimates of calorie. To calibrate your watch, follow the instructions in the link below support article. You can reset your calibration data and start the process:
      • On your iPhone, in the application of the watch, go to: Watch My > privacy > Motion & Fitness > tap reset Calibration data.

    More information:

    Use of the workout on your Apple Watch - Apple Support

    Your heart rate. What it means, and where on Apple Watch you will find. -Apple Support

    Calibrate your Apple Watch for better accuracy of training and activity - Apple Support

  • Since the installation of Mac Mavericks all my friends with Macs and I have problems with the cursor disappears, that in Firefox, Safari is very good...

    I stopped using Firefox as nothing I've done has corrected this problem. I tried to close Firefox and restart it, I erased all my Add-ons and then added adblock back (it's the only one), but it still does not work. I deleted files so that I have more space - I can't think of anything that works. I talked to four of my friends with Macs and they are all having the same problem with Firefox since the Mavericks.

    Cursor disappears huh? It's quite strange. All of the compatibility of the Mavericks can be followed in [Bug 883824]

    Try this work around:

    1. Go to Firefox > Preferences > advanced > general
    2. Always check "use the cursor keys to navigate through the pages.
    3. Press OK.

    Or try the Mac preferences noted here: https://discussions.apple.com/message/23542890#24471966

  • Boxes with numbers and letters show rather than some images on some websites

    Yammer.com and linkedin.com, images of icons, such as those that display along the top of the screen are not displayed. Instead, I see a rectangle with numbers and letters. I've seen several articles on the rectangles with numbers and letters that apply to the characters but none regarding images. I also tried the steps described in the article on the resolution of the images is not properly displayed, and nothing seems to work.

    Thank you!

    Many sites now display icons using a custom font. Firefox could not be download and using this font personalized for two reasons:

    (1) Firefox to use your fonts favorite instead of the police of the page; or

    (2) Firefox configured to do not to download fonts.

    For more information, see this thread: Yahoo mail display - action buttons like reply, delete, before them and the colors are not displayed. The solution to "clear the cache" does not help.

  • Extend a network of comments with AEBS and TC set up a connection

    Hi all-

    I was wondering if anyone has had any success with that extends a network invited on two airports or more that are wired together.  I use currently a Time Capsule as my main router (802.11ac), and have it configured with DHCP and NAT like fashion.  It connects via a connection wired to an Airport Extreme Base Station (802.11ac), which is set in Bridge mode and configured with a static IP address to the primary time Capsule.  The time Capsule is configured with a network of comments that is fully functional, and the AEBS extends the primary network using the same SSID and encryption on 2.4 and 5 GHz.  However, when I turn on the AEBS remote networking reviews, I can connect to the AEBS, but cannot obtain an IP address (the computer displays an automatic address assigned).  The SSID and the encryption is the same for both networks of comments.  I tried to use "extend a wireless network" on the AEBS and that will extend the network, but it is extremely slow due to the wireless connection it creates between two access points (I have the TC and wired together AEBS to offer increased coverage, because my house is not very "friendly wifi").

    I would greatly appreciate any help or insight anyone can provide, even if it's to tell me that a cable extension of the network of comments is not possible.

    Thank you

    Mike

    Wired to the guest network feature extension is indeed possible and should be implemented and enabled automatically if you are using "Assistant" Installation from Apple to expand the networks main and guests.

    I had this set up on the 2 airports and sometimes 3 for a few years and not a single hiccup.

    Suggest that you reset the AEBS back to default settings and then use configuration Apple "Wizard" to set up the AEBS again. It automatically adapts the AEBS to expand networks main and guests.  Everything you really need to do is enter a name of device to the AEBS, the wizard takes care of everything else for you.  It is one of the simplest game ups ever.

    Once you have the updated AEBS up and running, you can assign a static unit IP address if you want to, but it should not be necessary.

    After the back if you need some advice on the use of the Apple Setup Assistant to do the work for you.

Maybe you are looking for

  • How can I deactvate Flash blockers?

    I received the message "...". to continue you must turn off flash blockers. How do I do that?

  • Ox8004FF49

    What is the Ox8004FF49 code

  • Upgrade Vista, home premium to Ultimate 64

    I'm currently running Vista Home Premium 64, service Pack2.  I received an upgrade DVD from Microsoft, but it is for Ultimate 64, service pack 1.  When I try to install the upgrade, it indicates that the choice of upgrade is disabled.  Do I need to u

  • StackLayout works do not (children that overlap)

    I'm trying to use the StackLayout in AIR BB10 application for the first time and things are not stacked. Example code: package { import flash.display.Sprite; import qnx.fuse.ui.dialog.AlertDialog; import qnx.fuse.ui.text.Label; import flash.events.Ev

  • Windows Desktop Search is slow on Windows 8.1

    Hello I have tried everything I can find on these forums, but my research is still slow!  The problem I see is that I press the Windows key on my keyboard, then start typing a search term.  He never finds anything, it gives me just the points 'wait'