首页 \ 问答 \ GCM和特殊字符(GCM and Special characters)

GCM和特殊字符(GCM and Special characters)

我最近将我的c2dm push aaplucation更改为GCM。 出现了一个新问题。 它现在收到'?' 而不是'ö','ï', ...

我的服务器记录正确的字符串,但应用程序收到'?' insteads。

你认为这可能与GCM有关吗?

我的代码如下:

public static void displayMessage(Context context, Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras != null) {
        String message = (String) extras.get("message");
        Log.v("extras", extras.toString());
        Util.generateNotification(context, message, intent);
    }
}

然后日志是:

10-02 22:18:23.671: V/intent(29809): Bundle[{message={"name":"j?rg"},
message_id=8bb60eee-3a93-4075-b606-40495511a4da, collapse_key=do_not_collapse, from=160085429222}]

最好的祝福!


I recently changed my c2dm push aaplucation to GCM. A new problem appeared. Its now receiving '?' instead of 'ö','ï', ...

My server logs correct Strings, but the application receives '?' insteads.

Do you think it could have something to do with GCM?

My code is the following:

public static void displayMessage(Context context, Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras != null) {
        String message = (String) extras.get("message");
        Log.v("extras", extras.toString());
        Util.generateNotification(context, message, intent);
    }
}

and the log is then:

10-02 22:18:23.671: V/intent(29809): Bundle[{message={"name":"j?rg"},
message_id=8bb60eee-3a93-4075-b606-40495511a4da, collapse_key=do_not_collapse, from=160085429222}]

Best regards!


原文:https://stackoverflow.com/questions/12704567
更新时间:2023-07-29 14:07

最满意答案

使用Array.prototype.filter()

 var testArray = [{'id':1,"firstTeam":"Barcelona","secondTeam":"Real Madrid","Time":"14:00","commentator":"Unknown","championship":"UEFA","channel":"BEIN SPORT","iframe":'<iframe width="560" height="315" src="https://www.youtube.com/embed/pQRO_5dtqrk" frameborder="0" allowfullscreen></iframe>'},
{'id':2,"firstTeam":"Barcelona","secondTeam":"Real Madrid","Time":"14:00","commentator":"Unknown","championship":"UEFA","channel":"BEIN SPORT","iframe":''}];

var filtered = testArray.filter(filterFunction);

// Let's assume you want to filter by ID, stored in $scope variable.
$scope.filterById = 2;


function filterFunction(val) {
  return value.id == $scope.filterById;
}

Use Array.prototype.filter():

 var testArray = [{'id':1,"firstTeam":"Barcelona","secondTeam":"Real Madrid","Time":"14:00","commentator":"Unknown","championship":"UEFA","channel":"BEIN SPORT","iframe":'<iframe width="560" height="315" src="https://www.youtube.com/embed/pQRO_5dtqrk" frameborder="0" allowfullscreen></iframe>'},
{'id':2,"firstTeam":"Barcelona","secondTeam":"Real Madrid","Time":"14:00","commentator":"Unknown","championship":"UEFA","channel":"BEIN SPORT","iframe":''}];

var filtered = testArray.filter(filterFunction);

// Let's assume you want to filter by ID, stored in $scope variable.
$scope.filterById = 2;


function filterFunction(val) {
  return value.id == $scope.filterById;
}

相关问答

更多
  • 您可以使用parse函数预处理服务器响应: MyApp.Models.Users = Backbone.Model.extend({ parse: function(response) { var classesJSON = response.classes; var classesCollection = MyApp.Collections.ClassList(classesJSON); response.classes = classesCollection; ret ...
  • 使用Array.prototype.filter() : var testArray = [{'id':1,"firstTeam":"Barcelona","secondTeam":"Real Madrid","Time":"14:00","commentator":"Unknown","championship":"UEFA","channel":"BEIN SPORT","iframe":'