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

  • Home
  • SEARCH
  • 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 7786123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:21:56+00:00 2026-06-01T20:21:56+00:00

I’m dealing with a replacement character inside a MySQL database… and it’s fine if

  • 0

I’m dealing with a replacement character inside a MySQL database… and it’s fine if it stays there but I’m trying to edit it. My form displays the character as a diamond shape with a question mark in it (�). So I submit the form, I compare the data between the one on the form to the one in the data to see if it has changed. The problem here is that when I submit the form it turns the replacement character into � which is the html entity equivalent so when this happens it fails the comparison and the code thinks the string has changed– which it has, but not really. I’ve tried to employ different methods of either turning the replacement character into the html entity equivalent from the database when it’s being compared –it starts to turn another seemingly normal characters into another replacement character html entity equivalent– and turning the html entities into the replacement character –which simply does not work for this– but they both fail. And yes, I have tried html_entity_decode() and htmlspecialchars_decode()

My questions is: How can I keep the replacement character from turning into an html entity?

  • 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-01T20:21:57+00:00Added an answer on June 1, 2026 at 8:21 pm

    For some reason, the webbrowser is submitting the � REPLACEMENT CHARACTER (U+FFFD) as it’s decimal, numeric HTML Entitiy: �. Probably you’re already outputting it that way to the browser?

    However, if you expect the input to contain HTML entities, you need to decode them if you don’t want to store them into your database as HTML. To decode numeric entities within an incomming UTF-8 encoded string $str:

    $convmap = array (0, 0x10FFFF, 0, 0xFFFFFF);
    $output = mb_decode_numericentity($str, $convmap, 'UTF-8');
    

    This code does actually do the conversion you’re looking for (Demo), however you should clarify first why a numeric HTML entity is submitted.

    As you prefer unicode, I suggest you make use of UTF-8 for the webpage:

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

    and for the form:

    <form action="" method="post" accept-charset="utf-8">
    

    good luck.

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

Sidebar

Related Questions

I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.