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

  • Home
  • SEARCH
  • 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 7500907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:21:12+00:00 2026-05-29T20:21:12+00:00

Background: I’ve created a website that displays currency rates from various countries. I use

  • 0

Background:

I’ve created a website that displays currency rates from various countries. I use Google’s currency converter API to perform the calculations.

http://www.google.com/ig/calculator?h1=en&q=9999gbp=?usd

Notice the query I have passed in e.g. 9999 Great British Pounds to United States Dollars.

The API returns:

{lhs: "9999 British pounds",rhs: "15 769.4229 U.S. dollars",error: "",icc: true}

Google has separated the 15 769.4229 with white space between the 5 and the 7.

This causes a problem when I return the results of a calculation on my site as the white space char is replaced with the � symbol.

See screen shot below:

enter image description here

Any ideas what this symbol is called so I can attempt to remove it?

<?php

// Check to ensure that form has been submitted 
if (isset($_POST['amount'], $_POST['from'], $_POST['to'])) {
    $amount = trim($_POST['amount']);
    $from = $_POST['from'];
    $to = $_POST['to'];

    try {
        $conversion = currency_convert($googleCurrencyApi, $amount, $from, $to);
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage();
    }

    // Check URL has been formed 
    if ($conversion == false) {
        echo 'Sorry, something went wrong';
    } else {
        echo $conversion[0], ' = ', $conversion[1];
    }

}

function currency_convert($googleCurrencyApi, $amount, $from, $to) {

    $result = file_get_contents($googleCurrencyApi . $amount . $from . '=?' . $to);
    $expl = explode('"', $result);

    if ($expl[1] == '' || $expl[3] == '') {
        throw new Exception('An error has occured.  Unable to get file contents');
    } else {
        return array(
            $expl[1],
            $expl[3]
        );
    }
}
?>

Here’s my code so far at the moment, so you get the idea behind my logic.

  • 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-29T20:21:16+00:00Added an answer on May 29, 2026 at 8:21 pm

    This is most probably non-breaking space, try replacing into space:

    $result = file_get_contents($googleCurrencyApi . $amount . $from . '=?' . $to);
    $result = str_replace("\xA0", " ", $result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background : I have built a tool that imports sales orders from Magento to
Background: At my company we are developing a bunch applications that are using the
Background: I have a css and a js that is used only by the
Background We currently use OpenID for authentication of users, and use the Claimed Identity
Background: I have a Visual Studio solution consisting of a website + REST web-service
Background: My employeer at my non-programming job knows that I am an undergraduate CS
Background - I want to extract specific columns from a csv file. The csv
Background This is only my second PyQt4 project. Developing a Windows app that has
Background I have a basic HTML page with an iframe that points to a
Background My project is urgent and requires that I iterate a large XML file

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.