문제

When I try sharing Unicode text on the BB10 Cascades framework, using the following code, all non-ASCII characters are converted to question marks at the invocation target, such as a BBM conversation or an email:

InvokeActionItem {
    title: qsTr("Share")
    id: shareCard

    query {
      mimeType: "text/plain"
    invokeActionId: "bb.action.SHARE"
    }

onTriggered: {
  data = getData();
    }
}

function getData(){

    return "¿Cómo están las cosas en el mundo hoy?";
}
도움이 되었습니까?

해결책

To workaround this, create a helper function in C++ that converts QStrings to Utf8, and call this from within your QML / JavaScript functions:

in your app.h

Q_INVOKABLE
QString Utf8EncodeString(const QString &encodeString);

in your app.cpp

QString app::Utf8EncodeString(const QString &encodeString) {
return encodeString.toUtf8();
}

In the QML change the getData() function thusly:

function getData(){
    return app.Utf8EncodeString("¿Cómo están las cosas en el mundo hoy?");
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top