0

我正在使用 Facebook 的 Graph API 和 JavaScript SDK 创建一个新专辑。在创建带有描述(消息)和名称的新专辑时,会编码特殊字符。但是,当我尝试对字符进行编码时,一旦创建专辑,它们就不会被解码。有没有其他人遇到过这个问题?

JavaScript

/** Example One: Facebook encodes characters **/
var albumName = "Album Name";
var albumDesc = "Description with áéíóú";
FB.api("/me/albums", "post", {message:albumDesc, name:albumName}, function(res) {
     albumID = res.id;
     uploadPhotoToAlbum(albumID);
});

/** Example Two: Facebook does not decode characters **/
var albumName = "Album Name";
var albumDesc = "Description with %C3%A1%C3%A9%C3%AD%C3%B3%C3%BA";
FB.api("/me/albums", "post", {message:albumDesc, name:albumName}, function(res) {
     albumID = res.id;
     uploadPhotoToAlbum(albumID);
});

/** Example Three: Facebook does not decode characters **/
var albumName = "Album Name";
var albumDesc = "Description with áéíóú";
FB.api("/me/albums", "post", {message:albumDesc, name:albumName}, function(res) {
     albumID = res.id;
     uploadPhotoToAlbum(albumID);
});
4

1 回答 1

0

对于可能遇到此问题的其他任何人,我发现这是由于文件编码造成的。将文件编码为 UTF-8 后,“示例一”按预期工作。

于 2012-10-05T14:39:16.470 回答