Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
Posts: 5
Registered: ‎01-09-2013
My Device: BB10 Alpha B
My Carrier: Uff
Accepted Solution

Encoding issue when using Invocation/InvokeQuery in Cascades

I'm having an issue trying to share spanish text using Invocation, seems to be an encoding issue but I'm not sure how to fix it, following code shows the issue. Instead of getting the text I get this: 

 

This is the code I'm using:

import bb.cascades 1.0

Page {
    attachedObjects: [
        Invocation {
            id: invokeShare
            query: InvokeQuery {
                id: invq
                mimeType: "text/plain"
                data: " ¡Tratando de compartir algo en español!"
                invokeActionId: "bb.action.SHARE"
                onQueryChanged: invq.updateQuery()
            }
        }
    ]
     
    Container {
        layout: DockLayout {}
        Button {
            text: "Click"
            onClicked: {
                invokeShare.trigger("bb.action.SHARE")
            }
        }
    }
}

 

New Contributor
Posts: 5
Registered: ‎01-09-2013
My Device: BB10 Alpha B
My Carrier: Uff

Re: Encoding issue when using Invocation/InvokeQuery in Cascades

[ Edited ]

The data line appears wrong, no matter what I do, it should read:

data : "¡Tratando de compartir algo en español!"

Thanks.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Encoding issue when using Invocation/InvokeQuery in Cascades

Hi!

 

'data' parameter expects a QByteArray. By default the string is converted to QByteArray using ASCII encoding. You'll need to convert it to Utf8 instead. This can be done using a C++ helper function: http://supportforums.blackberry.com/t5/Native-Development/sharing-data-of-type-QString-using-Invocat...


Andrey Fidrya, @zmeyc on twitter