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 8149779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:55:09+00:00 2026-06-06T14:55:09+00:00

I’m trying to figure out why special characters in a JSON feed (that looks

  • 0

I’m trying to figure out why special characters in a JSON feed (that looks completely fine when viewed in a browser) will break when used in my Android code. Characters with accent marks, ellipsis characters, curly quote characters and so on are replaced by other characters–perhaps translating it from UTF-8 down to ASCII? I’m not sure. I’m using a GET request to pull JSON data from a server, parsing it, storing it in a database, then using Html.fromHtml() and placing the contents in a TextView.

  • 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-06-06T14:55:11+00:00Added an answer on June 6, 2026 at 2:55 pm

    After much experimentation, I narrowed down possibilities until I discovered the problem is with the Ignition HTTP libraries (https://github.com/kaeppler/ignition). Specifically, with ignitedHttpResponse.getResponseBodyAsString()

    Although that’s a handy shortcut, that one line results in the broken characters. Instead, I now use:

    InputStream contentStream = ignitedHttpResponse.getResponseBody();
    String content = Util.inputStreamToString(contentStream);
    
    
    public static String inputStreamToString(InputStream is) throws IOException {
            String line = "";
            StringBuilder total = new StringBuilder();
    
            // Wrap a BufferedReader around the InputStream
            BufferedReader rd = new BufferedReader(new InputStreamReader(is));
    
            // Read response until the end
            while ((line = rd.readLine()) != null) {
                total.append(line);
            }
    
            // Return full string
            return total.toString();
        }
    

    Edit: Adding more detail

    Here is a minimum test case to reproduce the issue.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);
    
        activity = this;
    
        instance = this;
    
        String url = SaveConstants.URL;
        IgnitedHttpRequest request = new IgnitedHttp(activity).get(url);
        InputStream contentStream = null;
        try {
        IgnitedHttpResponse response = request.send();
    
        String badContent = response.getResponseBodyAsString();
        int start = badContent.indexOf("is Texas");
        Log.e(TAG, "bad content: " + badContent.substring(start, start + 10));
        contentStream = response.getResponseBody();
        String goodContent = Util.inputStreamToString(contentStream);
        start = goodContent.indexOf("is Texas");
        Log.e(TAG, "good content: " + goodContent.substring(start, start + 10));
        } catch (IOException ioe) {
            Log.e(TAG, "error", ioe);
        }
    }
    

    In the log:

    bad content: is Texasâ good content: is Texas’

    Update: either I’m crazy, or the problem only occurs in the clients’ production feed, not their development feed, although the contents look identical when viewed in a browser–showing “Texas’”. So perhaps there’s some wonky server configuration required to cause this issue… but still, the fix for this issue when it occurs is as I outlined. I do not recommend using response.getResponseBodyAsString();

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

Sidebar

Related Questions

I need a function that will clean a strings' special characters. I do NOT
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I know there's a lot of other questions out there that deal with this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.