Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Encoding problem

  1. #1
    Join Date
    Sep 2008
    Posts
    8

    Post Encoding problem

    Hi guys! I'm facing an encoding issue on my Android project while posting an image to the user's Facebook profile.
    The image's caption is written in brazilian portuguese, so when I use characters like é, ã and á I get invalid symbols when I check the image's caption on Facebook.

    I'm using the following libs:
    • spring-android-auth-1.0.0.RC1.jar
    • spring-android-core-1.0.0.RC1.jar
    • spring-android-rest-template-1.0.0.RC1.jar
    • spring-security-crypto-3.1.0.RELEASE.jar
    • spring-social-core-1.0.2.RELEASE.jar
    • spring-social-facebook-1.0.1.RELEASE.jar


    Can anyone help me out?
    Thanks!

  2. #2
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Just trying to narrow the problem down a bit...is there any chance this has nothing to do with Android? Can you recreate the problem in a standard main() method?

    I ask because if it's truly a problem in Android, then I don't mind setting up the scenario to run it in Android and see what happens. But if it's not Android-specific, it'll be a lot easier to debug and test in a main() method or JUnit test. And if you manage to recreate it outside of Android, could you share that code here so I know that I'm debugging the same thing you're trying to do?
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Sep 2008
    Posts
    8

    Default

    Ok, I'm on it!

  4. #4
    Join Date
    Sep 2008
    Posts
    8

    Default

    Hi habuma,

    I could reproduce the problem in a main() method outside my Android project. It seems that when posting feed contents there is no encoding problems, but when posting photos there is. Please have a look at the attached image below.

    I can send you the code I wrote, but as it contains sensitive data (access token, app secret) I'll do it privately, ok?

    Thanks in advance.

    Screen Shot 2012-04-12 at 3.34.01 PM.jpg

  5. #5
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    If you can, just post the code here, but put placeholders for the token and secret (e.g., ACCESS_TOKEN and APP_SECRET). I'll take the code and plug in my own token/secret to test with.
    Craig Walls
    Spring Social Project Lead

  6. #6
    Join Date
    Sep 2008
    Posts
    8

    Default

    Ok, here is the code:

    package spring.social;

    import org.springframework.core.io.ClassPathResource;
    import org.springframework.core.io.Resource;
    import org.springframework.social.connect.Connection;
    import org.springframework.social.connect.ConnectionData;
    import org.springframework.social.facebook.api.Facebook;
    import org.springframework.social.facebook.connect.Facebo okConnectionFactory;

    public class App {

    private String clientId = "";
    private String clientSecret = "";
    private String accessToken = "";
    private String displayName = "";
    private long expireTime = 0L;
    private String imageUrl = "";
    private String profileUrl = "";
    private String providerId = "facebook";
    private String providerUserId = "";

    public App() {
    FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory(
    clientId, clientSecret);
    ConnectionData connectionData = new ConnectionData(providerId,
    providerUserId, displayName, profileUrl, imageUrl, accessToken,
    null, null, expireTime);
    Connection<Facebook> connection = connectionFactory
    .createConnection(connectionData);
    Facebook api = connection.getApi();
    Resource photo = new ClassPathResource("nautilus.jpg");
    api.mediaOperations().postPhoto(photo, "Meu café da manhã"); // has encoding problem
    api.feedOperations().post(providerUserId, "Meu café da manhã"); // no encoding problem
    }

    public static void main(String[] args) {
    new App();
    }

    }


    JARs in my classpath:
    spring-social-core-1.1.0.BUILD-SNAPSHOT.jar
    spring-web-3.1.0.RELEASE.jar
    aopalliance-1.0.jar
    spring-beans-3.1.0.RELEASE.jar
    spring-context-3.1.0.RELEASE.jar
    spring-aop-3.1.0.RELEASE.jar
    spring-expression-3.1.0.RELEASE.jar
    spring-asm-3.1.0.RELEASE.jar
    spring-core-3.1.0.RELEASE.jar
    commons-logging-1.1.1.jar
    spring-social-facebook-1.1.0.BUILD-SNAPSHOT.jar
    jackson-mapper-asl-1.9.3.jar
    jackson-core-asl-1.9.3.jar
    spring-security-crypto-3.1.0.RELEASE.jar

  7. #7
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Thanks...I'll try it out and let you know what I find...stay tuned.
    Craig Walls
    Spring Social Project Lead

  8. #8
    Join Date
    Nov 2012
    Posts
    1

    Default

    Hi habuma,
    did you happen to solve this issue? Looks exactly like one i'm dealing with.
    I'm using 1.0.2.RELEASE spring social and 1.0.0.RELEASE spring for android

  9. #9
    Join Date
    Mar 2008
    Posts
    4

    Default

    I'm also having exactly the same issue; I'm using spring-social-core-1.0.2.RELEASE and spring-3.1.1-RELEASE for JRE.

    Didn't anyone else stumble into this same problem?
    Did any of the developers even take a look at the problem?

  10. #10
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Yes, it was looked at and several encoding problems have been fixed in recent releases. I can't put my finger on *when* this was fixed (at least not without digging deeper in Git logs), but I just tried it with 1.1.0.M2 and it worked fine. If you're still having trouble, please open an issue at https://jira.springsource.org/browse/SOCIALFB.
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •