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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:25:21+00:00 2026-06-09T14:25:21+00:00

I have a string (taken from a MySQL database if it makes any difference)

  • 0

I have a string (taken from a MySQL database if it makes any difference) which looks normal enough:

Manufacture: <a href="http://www.x.com/">Blah</a>

The problem is that the space between Manufacture: and the <a> tag has a charcode of 194, not 32 as I would expect.

This is causing a preg_match with the following pattern to fail (please ignore the attempts to parse HTML with regex, I know it’s not a good idea but this particular dataset is predictable enough to get away with it):

/Manufacture: *(<a[^>]*>([A-Za-z- 0-9]+)<\/a>)/i

If I replace the rogue space with a normal space character in a text editor and try again, the expression matches as expected, but I need to alter it programatically.

I tried str_replace:

$text = str_replace(chr(194), ' ', $text);

But the preg_match still fails. I then tried preg_replace:

$text = preg_replace('/[\xC2]/', ' ', $text);

But that doesn’t work either, even though running that same pattern through preg_match does contain the expected match.

Does anyone have any ideas?

  • 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-09T14:25:23+00:00Added an answer on June 9, 2026 at 2:25 pm

    Can you please check the structure of the MySQL table where you get the contents of $text from? If the collation is utf8_general_ci or something like that then your string most likely contains a double-byte UNICODE character.

    enter image description here

    If that is the case then the PHP function iconv should do the trick. Here’s the example from the PHP manual. The IGNORE option should remove the UNICODE character from the string.

    <?php
    $text = "This is the Euro symbol '€'.";
    
    echo 'Original : ', $text, PHP_EOL;
    echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
    echo 'IGNORE   : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
    echo 'Plain    : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;
    
    ?>
    

    The above example will output something similar to:

    Original : This is the Euro symbol '€'.
    TRANSLIT : This is the Euro symbol 'EUR'.
    IGNORE   : This is the Euro symbol ''.
    Plain    :
    Notice: iconv(): Detected an illegal character in input string in .\iconv-example.php on line 7
    This is the Euro symbol '
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of tags taken from a MySQL database. Obviously, these tags
I have an EditText which takes a String from the user and a searchButton.
I have a MySQL database where I am storing information that is entered from
I have a project in which I'm accessing a MySql database on my web
I have to request data for a JS-script from a MySQL database (based upon
I have taken a jQuery script which would remove divs on a click, but
I have a number of exported text fields from an old access database that
I am working on having data taken from a form submit to a database,
Ok, so I've installed xampp 1.7.7 and have my mysql database set up and
I have a database which has raw text that needs to be analysed. For

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.