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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:41:00+00:00 2026-06-12T14:41:00+00:00

Im trying to get a some data from the db , but the output

  • 0

Im trying to get a some data from the db , but the output isn’t what i expected.
Doing my own querying on the db , i get this output : string 'C�te d�Ivoire' (length=13)

Querying the db from phpmyadmin i get normal output : Côte d’Ivoire

php.ini default charset, mysql db default charset , <meta> charset are all set to utf-8 .

I can’t fugire it out where the encoding is being made that i get different output with same configuration .

P.S. : using mysqli driver .

  • 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-12T14:41:02+00:00Added an answer on June 12, 2026 at 2:41 pm

    In the same page that gives you wrong results, try first running this instruction

    print base64_encode("Côte");
    

    The correct answer is Q8O0dGU.... If you get something else, like Q/R0ZQo..., this means that your script is working with another charset (here Latin-1) instead of UTF-8. It’s still possible that also MySQL and also the browser are playing tricks, but the line above ensures that PHP and/or your editor are playing you false.

    Next, extract Côte from the database and output its base64_encode. If you see Q8O0..., then the connection between MySQL and PHP is safely UTF8. If not, then whatever else might also be needed, you need to change the MySQL charset (SET NAMES utf8 and/or ALTER of table and database collation).

    If PHP is UTF8, and MySQL is UTF8, and still you see invalid characters, then it’s something between PHP and the browser. Verify that the content type header is sent correctly; if not, try sending it yourself as first thing in the script:

    Header('Content-Type: text/html; charset=UTF8');
    

    For example in Apache configuration you should have

    AddDefaultCharset utf-8
    

    Verify also that your browser is not set to override both server charset and auto-detection.

    NOTE: as a rule of thumb, if you get a single diamond with a question mark instead of a UTF8 international character, this means that an UTF8 reader received an invalid UTF8 code point. In other words, the entity showing the diamond (your browser) is expecting UTF8, but is receiving something else, for example Latin1 a.k.a. ISO-8859-15.

    Another difficult-to-track way of getting that error is if the output somehow contains a byte order mark (BOM). This may happen if you create a file such as

    ###<?php
        Header("Content-Type: text/html; charset=UTF8");
    ?>
    <html>
         <head>
             <meta http-equiv="content-type" content="text/html; charset=UTF8" />
         </head>
         <body>
             Hellò, world!
         </body>
    </html>
    

    where that ### is an (invisible in most editors) UTF8 BOM. To remove it, you either need to save the file as “without BOM” if the editor allows it, or use a different editor.

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

Sidebar

Related Questions

I am trying to get some data from openweathermap.org via java, but when I
I'm trying to get some data from a certain web-based api using the libcurl
I'm trying to get some data from a table, where the tag has no
Using php I am trying to get some data from a .csv file which
I have sugar crm instance and i was trying to get some data from
I am trying to get some form data from POST method. Here's the code
i am trying to get some data, but i dont know how can i
I'm trying to get some json data in my application, but it won't come
I am trying to get some data to display from an Array in Cakephp,
I'm trying to use jQuery.post() function to retrieve some data. But i get no

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.