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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:18:00+00:00 2026-05-22T03:18:00+00:00

I started a website some time ago using the wrong CHARSET in my DB

  • 0

I started a website some time ago using the wrong CHARSET in my DB and site. The HTML was set to ISO… and the DB to Latin… , the page was saved in Western latin… a big mess.

The site is in French, so I created a function that replaced all accents like “é” to “é“. Which solved the issue temporarily.

I just learned a lot more about programming, and now my files are saved as Unicode UTF-8, the HTML is in UTF-8 and my MySQL table columns are set to ut8_encoding…

I tried to move back the accents to “é” instead of the “é“, but I get the usual charset issues with the (?) or weird characters “â” both in MySQL and when the page is displayed.

I need to find a way to update my sql, through a function that cleans the strings so that it can finally go back to normal. At the moment my function looks like this but doesn’t work:

function stripAcc3($value){

 $ent =   array(
          'à'=>'à', 
          'â'=>'â', 
            'ù'=>'ù', 
          'û'=>'û',
            'é'=>'é', 
          'è'=>'è', 
          'ê'=>'ê', 
            'ç'=>'ç', 
            'Ç'=>'Ç', 
            "î"=>'î', 
            "Ï"=>'ï', 
            "ö"=>'ö', 
            "ô"=>'ô', 
            "ë"=>'ë', 
            "ü"=>'ü', 
            "Ä"=>'ä',
            "€"=>'€',
          "′"=> "'",
          "é"=> "é"
        );

    return strtr($value, $ent);
}

Any help welcome. Thanks in advance. If you need code, please tell me which part.

UPDATE

If you want the bounty points, I need detailed instructions on how to do it. Thanks.

  • 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-22T03:18:00+00:00Added an answer on May 22, 2026 at 3:18 am

    Try using the following function instead, it should handle all the issues you described:

    function makeStringUTF8($data)
    {
        if (is_string($data) === true)
        {
            // has html entities?
            if (strpos($data, '&') !== false)
            {
                // if so, revert back to normal
                $data = html_entity_decode($data, ENT_QUOTES, 'UTF-8');
            }
    
            // make sure it's UTF-8
            if (function_exists('iconv') === true)
            {
                return @iconv('UTF-8', 'UTF-8//IGNORE', $data);
            }
    
            else if (function_exists('mb_convert_encoding') === true)
            {
                return mb_convert_encoding($data, 'UTF-8', 'UTF-8');
            }
    
            return utf8_encode(utf8_decode($data));
        }
    
        else if (is_array($data) === true)
        {
            $result = array();
    
            foreach ($data as $key => $value)
            {
                $result[makeStringUTF8($key)] = makeStringUTF8($value);
            }
    
            return $result;
        }
    
        return $data;
    }
    

    Regarding the specific instructions of how to use this, I suggest the following:

    1. export your old latin database (I hope you still have it) contents as an SQL/CSV dump *
    2. use the above function on the file contents and save the result on another file
    3. import the file you generated in the previous step into the UTF-8 aware schema / database

    * Example:

    file_put_contents('utf8.sql', makeStringUTF8(file_get_contents('latin.sql')));
    

    This should do it, if it doesn’t let me know.

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

Sidebar

Related Questions

I have a website that started with ASP.NET and over time has had some
We have a website running .NET 2.0 and have started using the ASP.Net HttpRuntime.Cache
I am using Entity Framework with my website. To improve performance, I have started
I started to design website using the 960 grid system everything works amazingly apart
I started using PHP a couple of months ago. For the sake of creating
I started dabbling in groovy yesterday. There's an example on the groovy website that
I started using subversion for one of my projects and it would be absolutely
I have just started using the python-twitter API and it requires me to register
I started trying to play with Mono, mostly for fun at the moment. I
I started an application in Google App Engine right when it came out, to

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.