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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:54:51+00:00 2026-05-14T08:54:51+00:00

I have a HTML form that is sometimes submitted with accented characters: à, è,

  • 0

I have a HTML form that is sometimes submitted with accented characters: à, è, ì, ò, ù

I have a PHP script that exports these form submissions into CSV format, when I look at the CSV format in a text editor (vim or notepad for example) the characters look fine, but when opened with Open Office or Word, I get some funky results: �����

I am also passing these submission to salesforce and am getting an error: “The entity “Atilde” was referenced, but not declared.”

What can I do to ensure portability of my CSV file? What’s the proper way to handle the encoding?

My HTML file is content-type is set as: Content-Type: text/html; charset=utf-8
Data is being stored in MySQL as latin1_swedish_ci collation.

  • 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-14T08:54:51+00:00Added an answer on May 14, 2026 at 8:54 am

    Total encoding confusion! 🙂

    The table character set

    The MySQL table character set only determines what encoding MySQL should use internally, and thus the range of characters permitted.

    • If you set it to Latin-1 (aka ISO 8859-1), you will not be able to store international characters in your table.
    • Importantly, the character set does not affect the encoding MySQL uses when communicating with your PHP script.
    • The table collation specifies rules for sorting.

    The connection character set

    The MySQL connection character set determines the encoding you receive table data in (and should send data to MySQL in).

    • The encoding is set using SET NAMES, e.g. SET NAMES "utf8".
    • If this does not match the table encoding, MySQL automatically converts data on the fly.
    • If this does not match your page character set, you’ll have to manually perform character set conversion in PHP, using e.g. utf8_encode or mb_convert_encoding.

    Page character set

    The page character set, specified using the Content-Type header, tells the browser how to interpret the PHP script output.

    • As an HTTP header, it is not saved when you save the file from within your browser. The information is thus not available to OpenOffice or other programs.

    Recommendations

    Ideally, you should use the same encoding in all three places, and ideally, that encoding should be UTF-8.

    However, CSV will cause problems, since the file format does not include encoding information. It is thus up to the application to guess the encoding, and as you’ve seen, the guess will be wrong.

    • I don’t know about OpenOffice, but Microsoft Office will assume the Windows “ANSI” encoding, which usually means Latin-1 (or CP1252 to be specific).
    • Microsoft Office will also cause problems in countries that use “,” as a decimal separator, since Office then switches to using “;” as a field separator for CSV-files.

    Your best bet is to use Latin-1 for the CSV-file. I’d still use UTF-8 for the table and connection character sets though, and also UTF-8 for HTML pages.

    If you use UTF-8 for the connection character set (by executing SET NAMES "utf8" after connecting), you’ll need to run the text through utf8_decode to convert to Latin-1.

    That entity problem

    I am also passing these submission to salesforce and am getting an error: “The entity “Atilde” was referenced, but not declared.”

    This sounds like you’re passing HTML code in an XML context, and is unrelated to character sets. Try running the text through html_entity_decode.

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

Sidebar

Ask A Question

Stats

  • Questions 405k
  • Answers 406k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer On x86 OSX, the stack needs to be 16 byte… May 15, 2026 at 6:00 am
  • Editorial Team
    Editorial Team added an answer I understand the ApplicationDelegate object to be the best place… May 15, 2026 at 6:00 am
  • Editorial Team
    Editorial Team added an answer Maybe a helper... def created_at_for_view k k.created_at if k.created_at.to_date ==… May 15, 2026 at 6:00 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.