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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:40:29+00:00 2026-05-15T09:40:29+00:00

So, I have built on this system for quite some time, and it is

  • 0

So, I have built on this system for quite some time, and it is currently outputting Latin1 (ISO-8859-1) to the web browser, and this is the components:

MySQL – all data is stored with the Latin1 character set

PHP – All PHP text files are stored on disk with Latin1 encoding

HTML – The output has the http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ meta tag

So, I’m trying to understand how the encoding of the different parts come into play in my workflow. If I open a PHP script and change its encoding within the text editor to UTF-8 and save it back to disk and reload the web browser, the text is all messed up – unless the text comes from the DB. If I change the encoding of the DB to UTF-8 and keep the PHP files in latin1 I have to use utf8_decode() for the data to display correctly. And if I change the HTML code the browser will read it incorrectly.

So yeah, I realise that if I want to “upgrade” to UTF8, I have to update all three parts of this setup for it to work correctly, but since it’s a huge system with some 180k lines of PHP code and millions of posts in a lot of databases/tables, I don’t want to start something like this without understanding everything correctly.

What haven’t I thought about? What could mess this up beyond fixing? What are the procedures for changing the encoding of an entire MySQL installation and what’s the easiest way to change the encoding of hundreds or thousands of PHP files on disk?

The META tag is luckily added dynamically, so I’ll change that in one place only 🙂

Let me hear about your experiences with this.

  • 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-15T09:40:30+00:00Added an answer on May 15, 2026 at 9:40 am

    It’s tricky.

    You have to:

    • change the DB and every table character set/encoding – I don’t know much about MySQL, but see here
    • set the client encoding to UTF-8 in PHP (SET NAMES UTF8) before the first query
    • change the meta tag and possible the Content-type header (note the Content-type header has precedence)
    • convert all the PHP files to UTF-8 w/out BOM – you can easily do that with a loop and iconv.
    • the trickiest of all: you have to change most of your string function calls. Than means mb_strlen instead of strlen, mb_substr instead of substr and $str[index], etc.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this regex I built and tested in regex buddy. _ [ 0-9]{10}+
I have this typical scenario. I have a smartclient application built on .net 2.0
We have a Java Applet built using AWT. This applet lets you select pictures
I have a string that looks like this: Name1=Value1;Name2=Value2;Name3=Value3 Is there a built-in class/function
I have a website I've built in VS2005, C#, .NET 2.0. This website does
I have built a web page which contains a Crystal Report built using the
I've been a Visual C++ user for quite some time now, and in the
I've been working with branches for quite some time now, but I always used
I've been trying to implement a robust voting system in Rails for some time
I have this large C++ project that I need to build on a platform

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.