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

The Archive Base Latest Questions

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

My form <form action=saveProfile.php method=post name=ProfileUpdate id=ProfileUpdate > <input name=Smeknamn id=Smeknamn type=text value=<?php echo

  • 0

My form

<form action="saveProfile.php" method="post" name="ProfileUpdate" id="ProfileUpdate" >
<input name="Smeknamn" id="Smeknamn" type="text" value="<?php echo $v["user_name"]; ?>" maxlength="16" id="ctl00_ctl00_cphContent_cphContent_cphContentLeft_tbUsername" onkeydown="return ((event.keyCode != 16) || (event.keyCode == 16 &amp;&amp; this.value.length >= 1));" style="width: 130px;" />
</form>

When I try to echo $_POST["Smeknamn"]; on saveProfile.php i get Ã�Ã�Ã� on the characters Ö Ä Å

Why is this happening? saveProfile AND editProfile is encoded in UTF-8 without BOM, and meta utf8 and all that.

UPDATE UPDATE

$smeknamn = $data[“Smeknamn”]

Sorry forgot to mention that i had this foreach.
And its $smeknamn im echoing and getting ���.
I just tried $_POST[“Smeknamn”] and it echo out ÖÄÅ just fine.. So the problem is now in the foreach() that makes the öäå chars Ã�Ã�Ã�. How can i fix this?

foreach($_POST as $key => $value) {
    $data[$key] = filter($value);
}
function filter($data) {
    $data = trim(htmlentities(strip_tags($data)));

    if (get_magic_quotes_gpc())
        $data = stripslashes($data);

    $data = mysql_real_escape_string($data);

    return $data;
}
  • 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:26:12+00:00Added an answer on May 16, 2026 at 6:26 pm

    This is a character encoding issue.

    I guess your data is actually encoded with UTF-8 so the character Ö (U+00D6) is encoded with 0xC396. Now when htmlentities is called without specifying the charset parameter, it implicitly uses ISO 8859-1:

    […] optional third argument charset which defines character set used in conversion. Presently, the ISO-8859-1 character set is used as the default.

    And when interpreting the byte sequence 0xC396 with ISO 8859-1 it represents the two ISO 8859-1 characters 0xC3 and 0x96. Since there is the entity Atilde for the ISO 8859-1 character 0xC3, this character is replaced by htmlentities with the reference &Atilde;. But there isn’t any entity representing the second character 0x96, so it’s not being replaced. That means:

    htmlentities("\xC3\x96") === "&Atilde;\x96"
    

    Now when this is interpreted by the user agent, the character reference gets displayed correctly but the remaining byte 0x96 is not a valid byte sequence for a character in UTF-8. That’s why the replacement character � is displayed instead.

    So the problem is that you didn’t specify the correct character encoding for htmlentities:

    htmlentities("\xC3\x96", ENT_COMPAT, "UTF-8") === "&Ouml;"
    

    But as you’re already using UTF-8 for your output, you don’t need to replace such characters and using htmlspecialchars instead will suffice to replace the HTML special characters.

    But besides that, you shouldn’t use such an universal-like filter function as every language and context has its own special character that need to be taken care of.

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

Sidebar

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.