Charles Kirk
Charles Kirk

Reputation: 167

Special characters displaying incorrectly with html entities

I'm having trouble with some data I've imported from an XML file. Unfortunately I'm working with some spanish characters, usually I'd just htmlentites them, but it's not working.

Examples of what I'm trying to display:

PRCE PEDUCED FROM 1,395,000€

A delightful south facing villa located in Génova

Should be:

PRCE PEDUCED FROM 1,395,000€

A delightful south facing villa located in Génova  (no idea what that should be...)

Any ideas?

Edit: Table encoding is utf8_spanish_ci, PHP is currently set to ISO-8859-1 as a ditch effort. Client side is currently UTF-8

$text = nl2br($Property->description); 
$trans_text = iconv('UTF-8', 'ISO-8859-15//TRANSLIT//IGNORE', $text);
echo $trans_text;
echo htmlentities($trans_text, ENT_QUOTES, 'ISO-8859-15');

Upvotes: 1

Views: 1617

Answers (2)

nhalink
nhalink

Reputation: 513

Using the table on http://www.i18nqa.com/debug/utf8-debug.html I concluded in two steps:
€ => € => €
Génova => Génova => Génova

I believe you can update the content of your database like this:
UPDATE tablename SET columnname = REPLACE(columnname, '€', '€');

Upvotes: 5

CD001
CD001

Reputation: 8472

Check your database connection character set... it's possible you're running into this issue:

There are symbols like  and so on in database, what to do?

Upvotes: 0

Related Questions