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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:40:18+00:00 2026-06-13T06:40:18+00:00

I have come across some problems when inputting certain characters into my mysql database

  • 0

I have come across some problems when inputting certain characters into my mysql database using php. What I am doing is submitting user inputted text to a database. I cannot figure out what I need to change to allow any kind of character to be put into the database and printed back out through php as it’s suppose to.

My MySQL collation is: latin1_swedish_ci

Just before I send the text to the database from my form I use mysql_real_escape_string() on the data.

Example below

this text:

�People are just as happy as they make up their minds to be.�
� Abraham Lincoln 

is suppose to look like this:

“People are just as happy as they make up their minds to be.”
― Abraham Lincoln
  • 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-06-13T06:40:20+00:00Added an answer on June 13, 2026 at 6:40 am

    As mentioned by others, you need to convert to UTF8 from end to end if you want to support “special” characters. This means your web page, PHP, mysql connection and mysql table. The web page is fairly simple, just use the meta tag for UTF8. Ideally your headers would say UTF8 also.

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

    Set your PHP to use UTF8. Things would probably work anyway, but it’s a good measure to do this:

    mb_internal_encoding('UTF-8');
    mb_http_output('UTF-8');
    mb_http_input('UTF-8');
    

    For mysql, you want to convert your table to UTF8, no need to export/import.

    ALTER TABLE table_name CONVERT TO CHARACTER SET utf8
    

    You can, and should, configure mysql to default utf8. But you can also run the query:

     SET NAMES UTF8
    

    as the first query after establishing a connection and that will “convert” your database connection to UTF8.

    That should solve all your character display problems.

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

Sidebar

Related Questions

I have come across an annoying problem while writing some PHP4 code. I renamed
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
Hi i have come across some urls of the type http://localhost/jsfweb/cat/query/ where query is
I'm currently porting my GAE app to Python 2.7 and have come across some
I have taken over some code from a previous developer and have come across
I'm moving some code from Microsoft.Practices.EnterpriseLibrary.Validation.Validators to System.ComponentModel.DataAnnotations, and have come across a more
I am debugging some programs. In per-instruction debugging (Eclipse CDT), I have come across
I have been trying some programs in the C Language and come across to
Since I started iPhone/iPod Development I have come across some differences between how the
I notice that some of the hard combinatorial problems I come across can be

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.