Avatar of DrXoulian
DrXoulian
 asked on

UTF 8 character search issue.

I am using php to search for a given string from internet. I search for '°'. And it gives me nothing. I have set utf 8 in php and mysql. Whats wrong?
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DrXoulian

ASKER
Visit http://www.jahkenkenrecords.com/labels03.php?id=8377
You will see some ° there. Try to search for them. It returns nothing.
Why?
Ray Paseur

BuiltWith recognises an HTML5 document, generated by PHP in UTF-8 encoding.
https://builtwith.com/?http%3a%2f%2fwww.jahkenkenrecords.com%2flabels03.php%3fid%3d8377

It looks like what you want is the "degree" character.  There is a character entity that I would use for this.  It's °

The A-circumflex you're seeing is a UTF-8 character prefix for the degree character, when the degree is used explicitly, and not presented in the character entity.  The degree character looks like this, in ASCII:  °

This is all explained in the article about Unicode.

This line appears to have the wrong information:
<div class="jkrtable-cell"><a class="link-release" href="releases03.php?id=6590421">96° In The Shade</a></div>

Open in new window

And this line appears to have it right, so I would use whatever is generating this line and follow that guidance for the other lines.
<div class="jkrtable-cell"><a class="link-release" href="releases03.php?id=2422814">96º In The Shade / Prisoner In The Street</a></div>

Open in new window

SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
David Favor

Character set oddities can be challenging to figure out.

Best to step through each layer of your code logically.

Start with your storage engine + charset for fields, depending on how you've setup your Schema.

Then debug your page by pulling your page content with curl + verify returned content is correct outside a browser environment.

Then check inside your browser.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

abandoned question, accepting the working answers