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

  • Home
  • SEARCH
  • 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 6080433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:03:39+00:00 2026-05-23T11:03:39+00:00

I, like many other PHP developers have had issues with character encoding, the question

  • 0

I, like many other PHP developers have had issues with character encoding, the question will outline the steps I go through to ensure that my data is saved and outputted as UTF8. I would like any advice on what else I should consider and or change with my current thinking.

I have a mysql database DEFAULT CHARACTER UTF-8 my tables have collation of utf8_general_ci

I am using a php script to read data from an RSS feed then saving that data to by database. Before I save that data I check to see whether that data is UTF-8 or not by doing the following:

protected function _convertToUTF8($content) {
    $enc = mb_detect_encoding($content);
    return mb_convert_encoding($content, "UTF-8", $enc);
}

When outputting this data to a webpage I set the headers in php

header("Content-type: text/html; charset=utf-8");

and I also set the Content-Type meta tag to be utf-8

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

So far everything works as expected I get no funny characters outputting and all is going smoothly, but should I be changing/considering anything else when dealing with this data?

The problem I am now having is outputting this data to a txt file (csv) I am using fwrite() which has successfully created the file but the 3rd party I am passing this file to says that the file is not UTF-8. I am not sure the data is being outputted as UTF-8, how can I check this? When logged into the remote server over SSH and i cat the file i get Itâs a when I vim the file I get Itâ~@~Ys when i less the file I get It<E2><80><99>s. What am I missing here?

Thanks in advance!

  • 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-23T11:03:39+00:00Added an answer on May 23, 2026 at 11:03 am

    In the end it was a BOM that was required for the external application to read the file properly.

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

Sidebar

Related Questions

Like many other SharePoint users, I've had to create a custom list definition. After
hello I'm learning php and i have seen many empty Function in many other
I apologize if this question is a duplicate. I have read many other mysqli
In Ruby, like in many other OO programming languages, operators are overloadable. However, only
So I have a User model that :has_many other models like Documents, Videos, Posts
I'd like to enable/disable some other controls based on how many items are in
Like many companies that require all access be through stored procedures, we seem to
Like many of you, I have to deal with a large amount of files:
I am not here to add another subjective question. I know that many developers
i have a LAPP (linux, apache, postgresql and php) environment, but the question is

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.