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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:07:30+00:00 2026-05-29T05:07:30+00:00

I am new here, so I apologize if I am doing anything wrong. I

  • 0

I am new here, so I apologize if I am doing anything wrong.

I have a form which submits user input onto another page. User is expected to type ä, ö, é, etc… I have placed all of the following in the document:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
header('Content-Type:text/html; charset=UTF-8');
<form action="whatever.php" accept-charset="UTF-8">

I even tried:

ini_set('default_charset', 'UTF-8');

When the other page loads, I need to check what the user input with something like:

if ( $_POST['field'] == $check ) {
  ...
}

But if he inputs something like ‘München’, PHP will compare ‘München’ with ‘München’ and will never trigger TRUE even though it should. Since it is specified UTF-8 everywhere, I am guessing that the server is converting to something else (Windows-1252 as I read on another thread) because it does not support or is not configured to UTF-8. I am using Apache on a local server before I load into production; I have not changed (and don’t know how to) any of the default settings. I’ve been working on a Windows 7, editing with Notepad++ enconding my files in ANSI. If I bin2hex('München') I get ‘4dc3bc6e6368656e’.

If I echo $_POST['field']; it displays ‘München’ correctly.

I have researched everywhere for an explanation, all I find is that I should include those tags/headings I already have.

Any help is much appreciated.

  • 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-29T05:07:31+00:00Added an answer on May 29, 2026 at 5:07 am

    You are facing many different problems at the same, let’s start with the simplest one.

    Problem 1) You say that echo $_POST['field']; will display it correctly? What do you mean with “display”? It can be displayed correctly in two cases:

    • either the field is in UTF-8 and your page has been declared as UTF-8 and the browser is displaying it as UTF-8 or,
    • the field is in Latin-1 and the browser has decided (through the auto-detection heuristics) that your page is in Latin-1.

    So, the fact that echo $_POST['field']; is correct tells you nothing.

    Problem 2) You are using

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    header('Content-Type:text/html; charset=UTF-8');
    

    Is this PHP code? If it is, it will be an error because the header must be set before sending out any byte. If you do this you will not set the Content-Type header and PHP should generate a warning.

    Problem 3) You are using

    <form action="whatever.php" accept-charset="UTF-8">
    

    Some browsers (IE, mostly) ignore accept-charset if they can coerce the data to be sent in ASCII or ISO Latin-1. So the data will be in UTF-8 and declared as ISO Latin-1 or ISO Latin-1 and sent as ISO Latin-1 (but this second case is not your case).

    Have a look at https://stackoverflow.com/a/8547004/449288 to see how to solve this problem.

    Problem 4) Which strings are you comparing? For example, if you have

    $city = "München"
    $_POST['city'] == $city
    

    The result of this code will depend on the encoding of the PHP file. If the file is encoded in ISO Latin-1 and the $_POST correctly contains UTF-8 data, the == will compare different bytes and will return false.

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

Sidebar

Related Questions

am new here. i have a slight problem; PLease look at the following code
I'm new here to stackoverflow, so bear with me. I have a book that
I'm new here and I hope anyonte can help me. I have WCF Service
I'm new around here and i have a little problems with a C# application.
Be aware that I might be doing this totally wrong, so I apologize in
I have a registration form which displays a users Name (textbox), Email (textbox) and
I'm new here and I've searched for questions to help me but I have
Hey folks, I have to apologize for my inexperience here, I've been working on
I am new here so first of all my greetings to you I am
I am new here. I would like to know how can I display HTML

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.