Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6908235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:32:14+00:00 2026-05-27T08:32:14+00:00

–Found the solution to my problem, code is updated– I am having a problem

  • 0

–Found the solution to my problem, code is updated–

I am having a problem sending German umlauts (öäü) via push-messages to the iPhone.
I am running Java/GWT on Google AppEngine and using UrbanAirship for the push notifications. The following code works perfectly on my mac, the push-notification arrives with the correct German umlauts in it. If I deploy it to the gae-server the German umlauts are not working. So far I found out that on GAE the standard encoding is US-ASCII and with some help here changed the getBytes() and everything else to UTF-8.
The problem is still there, but now the question marks which substituted the umlauts at the iPhone coming now with an “diamond” as background?!

Here comes the method I am using (works fine local, not at GAE):

private Boolean sendNotification(String appKey, String appMasterSecret, String jsonBodyString) {

    try {

        URL url = new URL("https://go.urbanairship.com/api/push/broadcast/");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setDoOutput(true);
        connection.setConnectTimeout(12000);

        String authString = appKey + ":" + appMasterSecret;
        String authStringBase64 = Base64.encode(authString.getBytes("UTF-8"));
        authStringBase64 = authStringBase64.trim();

        connection.setRequestProperty("Content-type", "application/json; charset:utf-8");
        connection.setRequestProperty("Authorization", "Basic " + authStringBase64);

        OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
        osw.write(new String(jsonBodyString.getBytes("UTF-8"),"UTF-8"));
        osw.close();

        int responseCode = connection.getResponseCode();
        String responseMessage = connection.getResponseMessage();
        if (responseCode == 200)
            return true;


    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return false;
    } catch (ProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return false;
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return false;
    }
    return false;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:32:14+00:00Added an answer on May 27, 2026 at 8:32 am

    getBytes() without an encoding! You should be ashamed! Well, not really 🙂

    String.getBytes():

    Encodes this String into a sequence of bytes using the platform’s default charset, storing the result into a new byte array.

    Use getBytes(String) or getBytes(Charset) instead — likely with UTF-8. (Similar issues affect new String(byte[]) and a few other methods.)

    Happy coding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
i have this code: <?php $valid_ext = array(pdf, doc); $args = array( 'post_type' =>
My NSXMLParser breaks on this string: <title>AAA &#8211; BCDEFGQWERTYUIO</title> I parsed it in this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I was beta-testing my iPhone App (not through xcode), and the app crashed. I
I'm having troubles with my meta tags with Open Graph. It seems as though
The problem with unsigned char. I am reading a PPM image file which has
I've got the following login script.. <?php $name = $_POST[name]; $password = $_POST[password]; $query
So to start, I have an array of XML files. These files need to
Have a webpage that will be viewed by mainly IE users, so CSS3 is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.