Return Json api accent

Asked

Viewed 173 times

0

I’m wearing a api which returns data in json. All the accents are coming modified.

J\u00FAnior

With php, what function I can use to reverse this situation?

**Though he had already torn it apart, he resembled this.*

CODE:

<!doctype html>
<html>
    <head>
        <title>Search approved payments in last month</title>
    </head>
    <body>
        <?php
        require_once "../../lib/mercadopago.php";

        $mp = new MP("XXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

        // Sets the filters you want
        $filters = array(
            //"range" => "date_created",
            //"begin_date" => "NOW-1MONTH",
            //"end_date" => "NOW",
           // "status" => "approved",
            //"operation_type" => "regular_payment"
        );

        // Search payment data according to filters
        $searchResult = $mp->search_payment($filters);

        echo "<pre>";
        print_r($searchResult);
        echo "</pre>";

        // Show payment information
        ?>
        <table border='1'>
            <tr><th>id</th><th>site_id</th><th>date_created</th><th>operation_type</th><th>external_reference</th></tr>
            <?php
            foreach ($searchResult["response"]["results"] as $payment) {
                ?>
                <tr>
                    <td><?php echo $payment["collection"]["id"]; ?></td>
                    <td><?php echo $payment["collection"]["site_id"]; ?></td>
                    <td><?php echo $payment["collection"]["date_created"]; ?></td>
                    <td><?php echo $payment["collection"]["operation_type"]; ?></td>
                    <td><?php echo $payment["collection"]["external_reference"]; ?></td>
                </tr>
                <?php
            }
            ?>
        </table>
    </body>
</html>
  • You don’t have to reverse, this is the Unicode character code, it’s exactly the most compatible way to handle special characters. PHP can then translate this into common text.

  • yes, when you print this in html it converts to accent alone

  • But in my case he’s not doing it... he’s printing it this way... The page is in UTF8...

  • This is a problem in the client, not the server. Put the stretch of the code you use to receive data from the API.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.