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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:22:54+00:00 2026-05-16T18:22:54+00:00

I have a file on my computer that I wanted to copy into a

  • 0

I have a file on my computer that I wanted to copy into a MySQL table using PHP. When I open the file the contents look fine, like normal text – but, when I attempt to read the file using PHP or insert into a MySQL table, I get all sorts of funky characters. I thought perhaps it was a utf-8 issue, so I tried setting the header

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

And then echoing the contents retrieved by file_get_contents(), but that didn’t make any difference – the output was still funky. I then thought perhaps it was a cp1252 issue so I tried using htmlentities() but that also didn’t help:

htmlentities($str, ENT_QUOTES, 'cp1252')

I then uploaded the file to a website (here). On the server when I ‘cat’ the file, it again looks normal, but in Firefox when I open it I get the funky characters. Here’s a screenshot of what it looks like to me: screenshot

Oddly I copied the same exact file to another website’s folder on the same server, and yet when I open this file at the new URL (see here) the same file appears different in Firefox – still some funky characters, but less of them. A screenshot of the different appearance: screenshot

Does anybody know what’s going on here, and how I can clean the characters up? What character encoding is this file using – and why does the same file look different in Firefox when copied from one website on the server to another?

  • 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-16T18:22:54+00:00Added an answer on May 16, 2026 at 6:22 pm

    Your file is in UTF-16; try using that as the encoding in Firefox. It looks much more correct, though there are still some stray CJK characters, which may be because some of your characters are in the wrong endianness.

    Please remember to accept an answer on all of your questions where a good answer was provided; many people on Stack Overflow may not continue to answer your questions with a lack of reputation incentive.

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

Sidebar

Related Questions

I have a file shredder on my computer, and I wanted to know if
I have a text file on one computer that I want to send to
Currently I have a website on my local computer that uses PHP to make
I am fairly new to php. I have a text file on my computer
Here's a puzzler. I have a variable that contains computer file paths. I need
I have a file with many lines in it. One of them look like
I have a file that contain huge number of net names. I would like
I'm using a new work computer that has an old sdk, Java 1.3.1, on
I have some projects from XNA 1.0 that I wanted to debug but when
I'm stuck, help me out !!! I have got a FILE table with: file_id

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.