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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:51:31+00:00 2026-06-06T16:51:31+00:00

I am experiencing some problem on UTF-8 Encoding. I have a CSV file and

  • 0

I am experiencing some problem on UTF-8 Encoding. I have a CSV file and this is the content of it:

Quién tú - Tes,  más , S03
Who you, More, SO2

I have extracted it one by one and I have this condition in my loop

if(mb_detect_encoding($exploded_value[$i], 'UTF-8', true))
{
   echo $cleaned_data = utf8_encode($exploded_value[$i]);
}
else
{
  echo $cleaned_data=$exploded_value[$i];
}

My cleaned data became like this:

Quién tú - Tes
más
S03

Who you
More
SO2

Character’s like á, ç, ú gets decoded and when retrieved it gives the wrong output.

Text with Spanish character are being detected as UTF-8 encode character. So, it falls into utf8_encode($exploded_value[$i]). And when utf8_encode perform its process it got decoded.

Declaration of my meta content type is charset=UTF8

Anyone have encountered this issue. Can you share on how did you fix it? Please help. I have googled around and didn’t find any luck.

  • 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-06T16:51:33+00:00Added an answer on June 6, 2026 at 4:51 pm

    Your logic is reversed: you are re-encoding what is already utf-8 encoded, and what is not you pass on as-is.

    To fix this just switch the if and else bodies:

    if(mb_detect_encoding($exploded_value[$i], 'UTF-8', true))
    {
       // already UTF-8
       echo $cleaned_data=$exploded_value[$i];
    }
    else
    {
       // not yet UTF-8
       echo $cleaned_data = utf8_encode($exploded_value[$i]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing some problems while trying to read a binary file in C. This
I am using cakephp 1.3.X . I am experiencing some problem with url routing
I am experiencing a problem with some Javascript - please see my site and
I am experiencing a problem with the following code in some versions of Internet
I'm currently experiencing some problems with my server. I have a pool which is
I'm experiencing some problem when I compile some legacy apps on VB6 since I
I'm experiencing some troubles with Qt's signals and slots mechanism. I have something like
I am experiencing some weird behavior with an android app I have been working
I have a Nivo slide gallery and am experiencing some weird inconsistency between browsers.
I'm experiencing a problem in some code I've been working on. Here is the

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.